[
https://issues.apache.org/jira/browse/PDFBOX-5681?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Lehmkühler resolved PDFBOX-5681.
----------------------------------------
Resolution: Fixed
I've found a way to avoid the ConcurrentModificationException. The solution ia
similar to the proposal of [~axh], but not that complex and IMHO easier to
understand ;-) Only two iterations are needed: the first one processes all
objects for the cross reference table and the second one processes additional
objects which may be added during the first iteration. The second step is only
needed if the number of indirect objects was increased during step one.
> ConcurrentModificationException in getObjectsByType() in 3.x
> ------------------------------------------------------------
>
> Key: PDFBOX-5681
> URL: https://issues.apache.org/jira/browse/PDFBOX-5681
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 3.0.0 PDFBox
> Reporter: Tim Allison
> Assignee: Andreas Lehmkühler
> Priority: Minor
> Fix For: 3.0.1 PDFBox, 4.0.0
>
> Attachments: PDFBOX-3714-2.pdf
>
>
> [~tilman]'s regression testing turned up this exception when we integrate
> PDFBox 3.0.0 into Tika:
> {noformat}
> java.util.ConcurrentModificationException
> at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1597)
> at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1620)
> at
> org.apache.pdfbox.cos.COSDocument.getObjectsByType(COSDocument.java:254)
> at
> org.apache.pdfbox.cos.COSDocument.getObjectsByType(COSDocument.java:240)
> {noformat}
> I can replicate this exception consistently on the attached file.
> With this code:
> {noformat}
> Path path = Paths.get("/.../PDFBOX-3714-2.pdf");
> PDDocument document = Loader.loadPDF(path.toFile());
> List<COSObject> objs =
> document.getDocument().getObjectsByType(COSName.FILESPEC);
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]