pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1768562 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java
Date Mon, 07 Nov 2016 17:22:41 GMT
Author: tilman
Date: Mon Nov  7 17:22:41 2016
New Revision: 1768562

URL: http://svn.apache.org/viewvc?rev=1768562&view=rev
Log:
PDFBOX-3558: use 1 as default if BitsPerComponent is missing

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java?rev=1768562&r1=1768561&r2=1768562&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java Mon
Nov  7 17:22:41 2016
@@ -35,7 +35,6 @@ import org.apache.commons.logging.LogFac
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.cos.COSInteger;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSStream;
 
@@ -82,7 +81,7 @@ public class JBIG2Filter implements Filt
         {
             decodeParms = (COSDictionary) ((COSArray) decodeP).getObject(filterIndex);
         }
-        COSInteger bits = (COSInteger) options.getDictionaryObject(COSName.BITS_PER_COMPONENT);
+        int bits = options.getInt(COSName.BITS_PER_COMPONENT, 1);
         COSStream st = null;
         if (decodeParms != null)
         {
@@ -102,9 +101,9 @@ public class JBIG2Filter implements Filt
         {
             // I am assuming since JBIG2 is always black and white 
             // depending on your renderer this might or might be needed
-            if(bi.getColorModel().getPixelSize() != bits.intValue()) 
+            if (bi.getColorModel().getPixelSize() != bits)
             {
-                if(bits.intValue() != 1)
+                if (bits != 1)
                 {
                     LOG.error("Do not know how to deal with JBIG2 with more than 1 bit");
                     return;



Mime
View raw message