[
https://issues.apache.org/jira/browse/PDFBOX-2685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14323783#comment-14323783
]
Andreas Lehmkühler commented on PDFBOX-2685:
--------------------------------------------
{quote} I looked at removing setDirect but it much more has the potential to
cause regressions. {quote}
IMHO we are still at a point where such changes are allowed inlcuding possible
regressions. I have such changes (COSStream) on my list too.
{quote}There are only a small number of items which have to be direct as there
are some which shall be indirect. We would be better off to handle that
specifically. Unfortunately e.g. COSWriter has not been built that way. {quote}
The current implementation of the COSWriter is a more generic one and I'm not
sure if it would be a good idea to change that. Whatever we are going to do it
would require a lot of changes and I'm not sure if that fits into our timeframe.
With the current changes we are not on the save side but we are already saver.
As lons as we limit the caching to values from -100 to 256 it's most unlikely
that a cached COSInteger is used twice, once as direct and once as indirect
value. Saying that, IMHO we should postpone the root issue to a later version.
> COS 'primitive' types are 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
> Assignee: Maruan Sahyoun
> 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]