[ https://issues.apache.org/jira/browse/PDFBOX-4398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17297501#comment-17297501 ]
Tilman Hausherr commented on PDFBOX-4398: ----------------------------------------- Are we done here? > getLastSignatureDictionary modifies internal structure of PDDocument > -------------------------------------------------------------------- > > Key: PDFBOX-4398 > URL: https://issues.apache.org/jira/browse/PDFBOX-4398 > Project: PDFBox > Issue Type: Bug > Components: AcroForm > Affects Versions: 2.0.12 > Reporter: beat weisskopf > Assignee: Maruan Sahyoun > Priority: Minor > Fix For: 2.0.23, 3.0.0 PDFBox > > > If one calls PDDocument#getLastSignatureDictionary, the AcroFrom is populated > with the defaults even if not needed. This modifies the internals of the > PDDocument and therefore there are changes to be saved, even if the file is > not modified by "real" changes. > For example: > {code} > PDDocument pdfDocument = PDDocument.load(pdfBytes); > pdfDocument.getLastSignatureDictionary(); > {code} > This calls the verifyOrCreateDefaults() method, which initializes the > DR-Dictionary if not yet done. This is even done if > getLastSignatureDictionary returns null. > Why this bothers me: it is very unexpected behaviour that a getter modifies > an objects state. This is no big deal for our usecase, the other issue > (PDFBOX-4303) was a bigger problem as we are diffing objects between > revisions (current vs last signed revision). -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org