This is an automated email from the ASF dual-hosted git repository. tilman pushed a commit to branch branch_2x in repository https://gitbox.apache.org/repos/asf/tika.git
commit 8b0a6a314ba024e1b53914a3b59caca5645fd1b0 Author: Tilman Hausherr <til...@apache.org> AuthorDate: Sat Aug 10 12:16:52 2024 +0200 TIKA-4290: replace deprecated, simplify code --- .../src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pdf-module/src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pdf-module/src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java index 9179fe956..5d7b50fb2 100644 --- a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pdf-module/src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java +++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pdf-module/src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java @@ -26,7 +26,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.commons.io.IOExceptionWithCause; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSStream; @@ -125,7 +124,7 @@ class PDF2XHTML extends AbstractPDF2XHTML { throw new TikaException("Unable to extract PDF content", e); } } - if (pdf2XHTML.exceptions.size() > 0) { + if (!pdf2XHTML.exceptions.isEmpty()) { //throw the first throw new TikaException("Unable to extract PDF content", pdf2XHTML.exceptions.get(0)); } @@ -187,7 +186,7 @@ class PDF2XHTML extends AbstractPDF2XHTML { } catch (SecurityException e) { throw e; } catch (Exception e) { - handleCatchableIOE(new IOExceptionWithCause(e)); + handleCatchableIOE(new IOException(e)); } } @@ -203,7 +202,7 @@ class PDF2XHTML extends AbstractPDF2XHTML { processedInlineImages, inlineImageCounter, xhtml, metadata, context); engine.run(); List<IOException> engineExceptions = engine.getExceptions(); - if (engineExceptions.size() > 0) { + if (!engineExceptions.isEmpty()) { IOException first = engineExceptions.remove(0); if (config.isCatchIntermediateIOExceptions()) { exceptions.addAll(engineExceptions);