[
https://issues.apache.org/jira/browse/PDFBOX-2685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14322045#comment-14322045
]
Maruan Sahyoun edited comment on PDFBOX-2685 at 2/15/15 4:29 PM:
-----------------------------------------------------------------
Looking at setDirect this only seems to be needed to set some COSBase objects
to be direct objects for streams and dictionaries. Now if we do know that for
specific streams and dictionaries that entry has to be direct why don't we add
it there and leave it out of the primitive types. In addition in COSWriter
there is already code to ensure that for Xref streams the length is direct. So
the flag is redundant.
A quick scan through the sources for setNeedToBeUpdate indicates the same that
it's only there for dictionaries.
WDYT?
was (Author: msahyoun):
Looking at setDirect this only seems to be needed to set some COSBase objects
to be direct objects for streams and dictionaries. Now if we do know that for
specific streams and dictionaries that entry has to be direct why don't we add
it there and leave it out of the primitive types. In addition in COSWriter
there is already code to ensure that for Xref streams the length is direct. So
the flag is redundant.
WDYT?
> COSInteger is mutable
> ---------------------
>
> Key: PDFBOX-2685
> URL: https://issues.apache.org/jira/browse/PDFBOX-2685
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 1.8.8, 1.8.9, 2.0.0
> Reporter: Tilman Hausherr
> Fix For: 2.0.0
>
>
> From [~torakiki]:
> They are cached and they are mutable so this:
> {code}
> COSInteger cosint = COSInteger.get(10);
> cosint.setValue(50);
> //lets move to a totally unrelated part of my software
> System.out.println(COSInteger.get(10));
> {code}
> prints COSInteger(50) so basically I ask for a 10 and get a 50, isn't it
> weird (and error prone)? ... or the way around, I call cosint.setValue(50) at
> some point in the software and that makes it a 50 everywhere I used
> COSInteger.get(10).
> That's of course also true for the other mutable attributes setDirect and
> setNeedToBeUpdate.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]