Author: lehmi
Date: Fri Jun 26 19:02:29 2015
New Revision: 1687838

URL: http://svn.apache.org/r1687838
Log:
PDFBOX-2301: omit empty streams

Modified:
    
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/COSStreamArray.java

Modified: 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/COSStreamArray.java
URL: 
http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/COSStreamArray.java?rev=1687838&r1=1687837&r2=1687838&view=diff
==============================================================================
--- 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/COSStreamArray.java
 (original)
+++ 
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/COSStreamArray.java
 Fri Jun 26 19:02:29 2015
@@ -173,12 +173,17 @@ public class COSStreamArray extends COSS
         for( int i=0;i<streams.size(); i++ )
         {
             COSStream stream = (COSStream)streams.getObject( i );
-            input.add( stream.getUnfilteredRandomAccess() );
-            //handle the case where there is no whitespace in the
-            //between streams in the contents array, without this
-            //it is possible that two operators will get concatenated
-            //together
-            input.add( new RandomAccessBuffer( inbetweenStreamBytes ) );
+            RandomAccessRead randomAccess = stream.getUnfilteredRandomAccess();
+            // omit empty streams
+            if (randomAccess.length() > 0)
+            {
+                input.add( randomAccess );
+                //handle the case where there is no whitespace in the
+                //between streams in the contents array, without this
+                //it is possible that two operators will get concatenated
+                //together
+                input.add( new RandomAccessBuffer( inbetweenStreamBytes ) );
+            }
         }
         return new SequenceRandomAccessRead(input);
     }


Reply via email to