You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by je...@apache.org on 2007/10/08 18:09:52 UTC

svn commit: r582858 - in /xmlgraphics/commons/trunk: src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java status.xml

Author: jeremias
Date: Mon Oct  8 09:09:50 2007
New Revision: 582858

URL: http://svn.apache.org/viewvc?rev=582858&view=rev
Log:
Bugzilla #43120:
Fixed a possible NPE in the TIFF codec (in the TIFFImage constructor).
Submitted by: Sergey Orlov <sorlov.at.mdi.ru>

Modified:
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java
    xmlgraphics/commons/trunk/status.xml

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java?rev=582858&r1=582857&r2=582858&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java Mon Oct  8 09:09:50 2007
@@ -327,9 +327,15 @@
             compression = compField == null ? COMP_NONE : compField.getAsInt(0);
 
             // Get the photometric interpretation.
-            int photometricType = (int)dir.getFieldAsLong(
-                                                          TIFFImageDecoder.TIFF_PHOTOMETRIC_INTERPRETATION);
-
+            int photometricType;
+            TIFFField photometricTypeField = dir.getField(
+                    TIFFImageDecoder.TIFF_PHOTOMETRIC_INTERPRETATION);
+            if (photometricTypeField == null) {
+                photometricType = 0; // White is zero
+            } else {
+                photometricType = photometricTypeField.getAsInt(0);
+            }
+            
             // Determine which kind of image we are dealing with.
             imageType = TYPE_UNSUPPORTED;
             switch(photometricType) {

Modified: xmlgraphics/commons/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/status.xml?rev=582858&r1=582857&r2=582858&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/status.xml (original)
+++ xmlgraphics/commons/trunk/status.xml Mon Oct  8 09:09:50 2007
@@ -25,6 +25,9 @@
 	</todo>
 	<changes>
 		<release version="Trunk" date="n/a">
+		  <action context="Code" dev="JM" type="add" fixes-bug="43120" due-to="Sergey Orlov">
+		    Fixed a possible NPE in the TIFF codec (in the TIFFImage constructor).
+		  </action>
 		  <action context="Code" dev="JM" type="add" fixes-bug="42980" due-to="Max Berger">
 		    Added support for classpath resources (find files in JAR files in the classpath
 		    using their MIME type)



---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org