lehmi commented on PR #107:
URL: https://github.com/apache/pdfbox/pull/107#issuecomment-1606085188

   > > > Hi, @lehmi! Have a question about your commit PDFBOX-5551: replace 
malformed (sub)stream with an empty one, DRY git-svn-id: 
https://svn.apache.org/repos/asf/pdfbox/trunk@1910585 
13f79535-47bb-0310-9956-ffa450edef68. PDPage.getContentsForRandomAccess method. 
Line 194. If substream is malformed and you wrote "it will be skipped" then why 
you didn't remove it from inputStreams list?
   > > 
   > > 
   > > I had two reasons in my mind. First of all in the case of a content 
stream which consists of several streams I didn't want to change the number of 
substreams so that the number of substreams is still in line with the number of 
COSArray elements. And in the case of a content streams which has only one 
stream I prefer to return an empty stream instead of returning null so that we 
don't have to change the code processing the stream
   > 
   > It looks like, if the exception will be thrown then last item will not be 
added. Is it expected behaviour?
   
   Thanks for being so persistent. Next I should have a look at the code itself 
instead of relying on my memories. Malformed substreams are simply ditched. The 
method returns an RandomAccessRead so that it is impossible to say how many 
subtreams are contained to it if we have a content stream consisting of several 
sub streams.
   Saying that I have to correct my first comment. Malformed streams are 
replaced with an empty stream and malformed substreams are simply skipped.
   Sorry for the confusion


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to