[
https://issues.apache.org/jira/browse/PDFBOX-3467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15426014#comment-15426014
]
Tilman Hausherr commented on PDFBOX-3467:
-----------------------------------------
This last change (besides breaking several tests) means that if an empty list
is returned, it cannot be modified (unless the empty list was there before),
but if a non empty list is returned, it can be modified. So a user would now
have to create an empty list if an empty list was returned and do what the
three removed lines did.
{code}
annots = new COSArray();
page.setItem(COSName.ANNOTS, annots);
retval = new COSArrayList<PDAnnotation>(new ArrayList<PDAnnotation>(), annots);
{code}
> PDPage.getAnnotations() modifies the PDF
> ----------------------------------------
>
> Key: PDFBOX-3467
> URL: https://issues.apache.org/jira/browse/PDFBOX-3467
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 2.0.2
> Reporter: John Hewson
> Assignee: John Hewson
> Fix For: 2.1.0
>
>
> I stumbled across this bug while using PDFDebugger.
> PDPage.getAnnotations() writes to the Page's COSDictionary, adding a new
> Annots entry if it is missing.
> This violates one of the rules which we introduced for 2.0, that reading from
> a PDF file should not result in the file's COS model being modified.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]