From e2a5cdd8730ef2243d95b2d6d558aebaaedc5e3c Mon Sep 17 00:00:00 2001 From: Jhonny Mertz <jhonnymertz@gmail.com> Date: Fri, 5 Jul 2019 20:46:02 -0300 Subject: [PATCH] updating libraries --- README.md | 4 ++-- pom.xml | 7 ++++--- .../integration/PdfIntegrationTests.java | 19 +++++-------------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index c05e283..ad15176 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ If you are using Gradle/Maven, see example below: In your `build.gradle`: ```groovy dependencies { - compile 'com.github.jhonnymertz:java-wkhtmltopdf-wrapper:1.1.10-RELEASE' + compile 'com.github.jhonnymertz:java-wkhtmltopdf-wrapper:1.1.11-RELEASE' } ``` @@ -26,7 +26,7 @@ In your `pom.xml`: <dependency> <groupId>com.github.jhonnymertz</groupId> <artifactId>java-wkhtmltopdf-wrapper</artifactId> - <version>1.1.10-RELEASE</version> + <version>1.1.11-RELEASE</version> </dependency> ``` diff --git a/pom.xml b/pom.xml index b07d7d2..e539037 100644 --- a/pom.xml +++ b/pom.xml @@ -43,13 +43,13 @@ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> - <version>3.4</version> + <version>3.9</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>2.5</version> + <version>2.6</version> </dependency> <dependency> @@ -75,7 +75,7 @@ <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>pdfbox</artifactId> - <version>2.0.15</version> + <version>2.0.16</version> <scope>test</scope> </dependency> @@ -93,6 +93,7 @@ <!-- Show 100% of the lines from the stack trace (doesn't work) --> <trimStackTrace>false</trimStackTrace> </configuration> + <version>2.22.1</version> <executions> <execution> <id>unit-tests</id> diff --git a/src/test/java/com/github/jhonnymertz/wkhtmltopdf/wrapper/integration/PdfIntegrationTests.java b/src/test/java/com/github/jhonnymertz/wkhtmltopdf/wrapper/integration/PdfIntegrationTests.java index 73c1847..b76f672 100644 --- a/src/test/java/com/github/jhonnymertz/wkhtmltopdf/wrapper/integration/PdfIntegrationTests.java +++ b/src/test/java/com/github/jhonnymertz/wkhtmltopdf/wrapper/integration/PdfIntegrationTests.java @@ -6,7 +6,7 @@ import com.github.jhonnymertz.wkhtmltopdf.wrapper.params.Param; import org.apache.pdfbox.pdfparser.PDFParser; import org.apache.pdfbox.pdmodel.PDDocument; -import org.apache.pdfbox.util.PDFTextStripper; +import org.apache.pdfbox.text.PDFTextStripper; import org.junit.Assert; import org.junit.Test; @@ -89,13 +89,9 @@ public void testRemovingGeneratedFile() throws Exception { } private String getPdfTextFromBytes(byte[] pdfBytes) throws IOException { - PDFParser parser = new PDFParser(new ByteArrayInputStream(pdfBytes)); + PDDocument pdDocument = PDDocument.load(new ByteArrayInputStream(pdfBytes)); + String text = new PDFTextStripper().getText(pdDocument); - // that is a valid PDF (otherwise an IOException occurs) - parser.parse(); - PDFTextStripper pdfTextStripper = new PDFTextStripper(); - PDDocument pdDocument = new PDDocument(parser.getDocument()); - String text = pdfTextStripper.getText(pdDocument); pdDocument.close(); return text; } @@ -128,13 +124,8 @@ public void testPdfWithXvfb() throws Exception { // WHEN byte[] pdfBytes = pdf.getPDF(); - - PDFParser parser = new PDFParser(new ByteArrayInputStream(pdfBytes)); - - // that is a valid PDF (otherwise an IOException occurs) - parser.parse(); - PDFTextStripper pdfTextStripper = new PDFTextStripper(); - String pdfText = pdfTextStripper.getText(new PDDocument(parser.getDocument())); + PDDocument pdDocument = PDDocument.load(new ByteArrayInputStream(pdfBytes)); + String pdfText = new PDFTextStripper().getText(pdDocument); Assert.assertThat("document should be generated", pdfText, containsString("Google")); }