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

Dominic Tubach commented on PDFBOX-2287:
----------------------------------------

This code fails with a NullPointerException:
{code}
COSStream stream = new COSStream(new RandomAccessBuffer());
stream.setFilters(COSName.FLATE_DECODE);
stream.getFilteredStream();
{code}
(In this example the stream is empty, but the problem is independent of the 
actual contents.) One could expect to get the filtered stream with the new 
filter(s) applied. A use case could be to reduce the number of applied filters, 
or to store a previously filtered stream completely unfiltered. Even though I 
don't think this is a common use case, IMHO it should be fixed anyway.

> [PATCH] COSStream loses contents in setFilters()
> ------------------------------------------------
>
>                 Key: PDFBOX-2287
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2287
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Dominic Tubach
>         Attachments: COSStream.patch
>
>
> When the setFilters method of COSStream is called when no decoding has been 
> done before, the stream contents are lost.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to