Author: tilman Date: Mon Nov 7 17:22:46 2016 New Revision: 1768563 URL: http://svn.apache.org/viewvc?rev=1768563&view=rev Log: PDFBOX-3558: use 1 as default if BitsPerComponent is missing
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java?rev=1768563&r1=1768562&r2=1768563&view=diff ============================================================================== --- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java (original) +++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/JBIG2Filter.java Mon Nov 7 17:22:46 2016 @@ -30,7 +30,6 @@ import javax.imageio.stream.ImageInputSt import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.pdfbox.cos.COSDictionary; -import org.apache.pdfbox.cos.COSInteger; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSStream; @@ -56,7 +55,7 @@ final class JBIG2Filter extends Filter DecodeResult result = new DecodeResult(new COSDictionary()); result.getParameters().addAll(parameters); - COSInteger bits = (COSInteger) parameters.getDictionaryObject(COSName.BITS_PER_COMPONENT); + int bits = parameters.getInt(COSName.BITS_PER_COMPONENT, 1); COSDictionary params = getDecodeParams(parameters, index); COSStream globals = null; @@ -93,9 +92,9 @@ final class JBIG2Filter extends Filter // I am assuming since JBIG2 is always black and white // depending on your renderer this might or might be needed - if (image.getColorModel().getPixelSize() != bits.intValue()) + if (image.getColorModel().getPixelSize() != bits) { - if (bits.intValue() != 1) + if (bits != 1) { LOG.warn("Attempting to handle a JBIG2 with more than 1-bit depth"); }