commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r999512 - in /commons/proper/sanselan/trunk: RELEASE_NOTES src/main/java/org/apache/sanselan/formats/jpeg/JpegImageMetadata.java
Date Tue, 21 Sep 2010 17:31:21 GMT
Author: sebb
Date: Tue Sep 21 17:31:20 2010
New Revision: 999512

URL: http://svn.apache.org/viewvc?rev=999512&view=rev
Log:
SANSELAN-44 - JpegImageMetadata getEXIFThumbnail may raise a null pointer exception

Modified:
    commons/proper/sanselan/trunk/RELEASE_NOTES
    commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageMetadata.java

Modified: commons/proper/sanselan/trunk/RELEASE_NOTES
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/RELEASE_NOTES?rev=999512&r1=999511&r2=999512&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/RELEASE_NOTES (original)
+++ commons/proper/sanselan/trunk/RELEASE_NOTES Tue Sep 21 17:31:20 2010
@@ -14,6 +14,7 @@ Version History:
 
 Next Release
 ------------
+ * SANSELAN-44 - JpegImageMetadata getEXIFThumbnail may raise a null pointer exception
  * Fixed a problem in the metadata example code not using exact matching for GPS values.
  * Fixed a possible NPE in Sanselan.getICCProfile pointed out by Jon Weygandt.
  * Fixed a bug in which gifs have incorrect size information in the the Logical Screen Descriptor.

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageMetadata.java?rev=999512&r1=999511&r2=999512&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageMetadata.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/jpeg/JpegImageMetadata.java
Tue Sep 21 17:31:20 2010
@@ -130,8 +130,21 @@ public class JpegImageMetadata implement
         return null;
     }
 
+    /**
+     * Get the thumbnail image if available.
+     * 
+     * @return the thumbnail image. 
+     *         May be <code>null</code> if no image could be found.
+     * @throws ImageReadException
+     * @throws IOException
+     */
     public BufferedImage getEXIFThumbnail() throws ImageReadException,
             IOException {
+
+        if (exif == null) {
+            return null;
+        }
+
         ArrayList dirs = exif.getDirectories();
         for (int i = 0; i < dirs.size(); i++) {
             TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) dirs



Mime
View raw message