Author: damjan Date: Sat Mar 3 15:20:54 2012 New Revision: 1296636 URL: http://svn.apache.org/viewvc?rev=1296636&view=rev Log: Allow RowsPerStrip to be optional, and treat it as infinity when it is.
Submitted by: Piyush Kapoor <pkapoor at adobe dot com> Jira issue key: SANSELAN-65 Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java?rev=1296636&r1=1296635&r2=1296636&view=diff ============================================================================== --- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java (original) +++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java Sat Mar 3 15:20:54 2012 @@ -478,9 +478,18 @@ public class TiffReader extends BinaryFi { TiffField rowsPerStripField = directory .findField(TiffTagConstants.TIFF_TAG_ROWS_PER_STRIP); - if (null == rowsPerStripField) - throw new ImageReadException("Can't find rows per strip field."); - int rowsPerStrip = rowsPerStripField.getIntValue(); + int rowsPerStrip ; + + if (null != rowsPerStripField) { + rowsPerStrip = rowsPerStripField.getIntValue(); + } else { + TiffField imageHeight = directory.findField(TiffTagConstants.TIFF_TAG_IMAGE_LENGTH); + /** + * if rows per strip not present then rowsPerStrip + * is equal to imageLength or an infinity value; + */ + rowsPerStrip = imageHeight.getIntValue(); + } return new TiffImageData.Strips(data, rowsPerStrip); } else