pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1642449 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
Date Sat, 29 Nov 2014 16:51:46 GMT
Author: tilman
Date: Sat Nov 29 16:51:46 2014
New Revision: 1642449

URL: http://svn.apache.org/r1642449
Log:
PDFBOX-2531: better error message on not yet read stream, as suggested by Ralf Hauser

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java?rev=1642449&r1=1642448&r2=1642449&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java Sat Nov 29 16:51:46
2014
@@ -292,7 +292,29 @@ public class COSStream extends COSDictio
 
         if (unFilteredStream == null || decodeResult == null)
         {
-            throw new IOException("Stream was not read");
+            String filterInfo = "";
+            COSBase filters = getFilters();
+            if (filters != null)
+            {
+                filterInfo = " - filter: ";
+                if (filters instanceof COSName)
+                {
+                    filterInfo += ((COSName) filters).getName();
+                }
+                else if (filters instanceof COSArray)
+                {
+                    COSArray filterArray = (COSArray) filters;
+                    for (int i = 0; i < filterArray.size(); i++)
+                    {
+                        if (filterArray.size() > 1)
+                        {
+                            filterInfo += ", ";
+                        }
+                        filterInfo += ((COSName) filterArray.get(i)).getName();
+                    }
+                }
+            }
+            throw new IOException("Stream was not read" + filterInfo);
         }
         else
         {



Mime
View raw message