You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2018/12/06 11:01:00 UTC

[jira] [Comment Edited] (PDFBOX-4398) getLastSignatureDictionary modifies internal structure of PDDocument

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

Tilman Hausherr edited comment on PDFBOX-4398 at 12/6/18 11:00 AM:
-------------------------------------------------------------------

This was introduced in PDFBOX-3732 and also badly needed by PDFBOX-4393. Yes such side effects are usually a no-no but we replicated the behavior of Adobe. See also the ending comment by Maruan in PDFBOX-3732.

From your text I understand that it bothers you, but it doesn't break anything. So I'd just target this to 3.0 and keep 2.x as is. I won't do anything for now.


was (Author: tilman):
This was introduced in PDFBOX-3732 and also badly needed by PDFBOX-4393. Yes such side effects are usually a no-no but we replicated the behavior of Adobe. See also the ending comment by Maruan in PDFBOX-3732.

From your text I understand that it bothers you, but it doesn't break anything. So I'd just target this to 3.0, set it to minor and keep 2.x as is. I won't do anything for now.

> 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
>            Priority: Minor
>             Fix For: 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
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org