[ 
https://issues.apache.org/jira/browse/PDFBOX-5681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763759#comment-17763759
 ] 

Tim Allison commented on PDFBOX-5681:
-------------------------------------

When I run the demo code in PDFBox trunk with logging on, I see this in the log 
before the new exception.  Further, when running debug in the PDFBox project, I 
can confirm that the xrefTable is somehow being modified during the iteration 
of the objects.

{noformat}
11.09.2023 10:49:07 ERROR cos.COSObject:126 - Can't dereference COSObject{5, 0}
java.io.IOException: Wrong type of referenced length object COSObject{6, 0}: 
COSDictionary
        at org.apache.pdfbox.pdfparser.COSParser.getLength(COSParser.java:845) 
~[classes/:?]
        at 
org.apache.pdfbox.pdfparser.COSParser.parseCOSStream(COSParser.java:875) 
~[classes/:?]
        at 
org.apache.pdfbox.pdfparser.COSParser.parseFileObject(COSParser.java:710) 
~[classes/:?]
        at 
org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:631)
 ~[classes/:?]
        at 
org.apache.pdfbox.pdfparser.COSParser.dereferenceCOSObject(COSParser.java:586) 
~[classes/:?]
        at org.apache.pdfbox.cos.COSObject.getObject(COSObject.java:121) 
~[classes/:?]
        at 
org.apache.pdfbox.cos.COSDocument.getObjectsByType(COSDocument.java:257) 
~[classes/:?]
        at 
org.apache.pdfbox.cos.COSDocument.getObjectsByType(COSDocument.java:240) 
~[classes/:?]
        at 
org.apache.pdfbox.TestConcurrentModification.oneOff(TestConcurrentModification.java:18)
 ~[test-classes/:?]
...
{noformat}

> 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
>            Priority: Minor
>         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]

Reply via email to