summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUday Kiran jandhyala <ukiran@codeaurora.org>2014-05-21 18:44:17 +0530
committerLinux Build Service Account <lnxbuild@localhost>2014-11-04 08:23:16 -0700
commit9043df532143a9eb751e2b095ae495ae8a5f054e (patch)
tree5e63e53d4718a7cdf5c8ed1c14ff63e09d00fbc7
parent2f74516bcc7eb0f89f65260e90175b07513aed95 (diff)
downloadandroid_packages_apps_Gallery2-9043df532143a9eb751e2b095ae495ae8a5f054e.tar.gz
android_packages_apps_Gallery2-9043df532143a9eb751e2b095ae495ae8a5f054e.tar.bz2
android_packages_apps_Gallery2-9043df532143a9eb751e2b095ae495ae8a5f054e.zip
Fixed NullPointerException when EXIF data is invalid
For some images with no / invalid EXIF data, Gallery crashes Fixed this bug by catching NullPointerException Change-Id: I656fe6d526c981933c3d6eeefe67cda860206e2d
-rw-r--r--gallerycommon/src/com/android/gallery3d/exif/ExifInterface.java2
-rw-r--r--src/com/android/gallery3d/filtershow/cache/ImageLoader.java4
-rw-r--r--src/com/android/gallery3d/filtershow/tools/SaveImage.java2
3 files changed, 7 insertions, 1 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/exif/ExifInterface.java b/gallerycommon/src/com/android/gallery3d/exif/ExifInterface.java
index a1cf0fc85..87db689e8 100644
--- a/gallerycommon/src/com/android/gallery3d/exif/ExifInterface.java
+++ b/gallerycommon/src/com/android/gallery3d/exif/ExifInterface.java
@@ -732,7 +732,7 @@ public class ExifInterface {
* @param inStream an InputStream containing a jpeg compressed image.
* @throws IOException
*/
- public void readExif(InputStream inStream) throws IOException {
+ public void readExif(InputStream inStream) throws IOException, NullPointerException {
if (inStream == null) {
throw new IllegalArgumentException(NULL_ARGUMENT_STRING);
}
diff --git a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
index 52c296c78..ea559e569 100644
--- a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
+++ b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
@@ -147,6 +147,8 @@ public final class ImageLoader {
return parseExif(exif);
} catch (IOException e) {
Log.w(LOGTAG, "Failed to read EXIF orientation", e);
+ } catch (NullPointerException e) {
+ Log.w(LOGTAG, "Invalid EXIF data", e);
} finally {
try {
if (is != null) {
@@ -576,6 +578,8 @@ public final class ImageLoader {
return taglist;
} catch (IOException e) {
Log.w(LOGTAG, "Failed to read EXIF tags", e);
+ } catch (NullPointerException e) {
+ Log.e(LOGTAG, "Failed to read EXIF tags", e);
}
}
return null;
diff --git a/src/com/android/gallery3d/filtershow/tools/SaveImage.java b/src/com/android/gallery3d/filtershow/tools/SaveImage.java
index 0c12fa4d9..ecf3e2fae 100644
--- a/src/com/android/gallery3d/filtershow/tools/SaveImage.java
+++ b/src/com/android/gallery3d/filtershow/tools/SaveImage.java
@@ -256,6 +256,8 @@ public class SaveImage {
Log.w(LOGTAG, "Cannot find file: " + source, e);
} catch (IOException e) {
Log.w(LOGTAG, "Cannot read exif for: " + source, e);
+ } catch (NullPointerException e) {
+ Log.w(LOGTAG, "Invalid exif data for: " + source, e);
} finally {
Utils.closeSilently(inStream);
}