summaryrefslogtreecommitdiffstats
path: root/packages/WallpaperCropper
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2014-03-21 20:32:34 +0100
committerSelim Cinek <cinek@google.com>2014-03-21 20:32:34 +0100
commit5ab7d37d903f336c5a96f8caca9b36439e76bdb4 (patch)
tree2f529e3f447035a43d96379ebe0ab6f035ac7aa8 /packages/WallpaperCropper
parentfc558d56c2040220853d9912d765cfc535463689 (diff)
downloadframeworks_base-5ab7d37d903f336c5a96f8caca9b36439e76bdb4.zip
frameworks_base-5ab7d37d903f336c5a96f8caca9b36439e76bdb4.tar.gz
frameworks_base-5ab7d37d903f336c5a96f8caca9b36439e76bdb4.tar.bz2
Catch exceptions if Exif is malformed
Bug: 11650650 Change-Id: Ie1680220fdb235a166a0eaa0a2309729f861865c
Diffstat (limited to 'packages/WallpaperCropper')
-rw-r--r--packages/WallpaperCropper/src/com/android/photos/BitmapRegionTileSource.java6
-rw-r--r--packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java3
2 files changed, 9 insertions, 0 deletions
diff --git a/packages/WallpaperCropper/src/com/android/photos/BitmapRegionTileSource.java b/packages/WallpaperCropper/src/com/android/photos/BitmapRegionTileSource.java
index cdc5cdc..764156d 100644
--- a/packages/WallpaperCropper/src/com/android/photos/BitmapRegionTileSource.java
+++ b/packages/WallpaperCropper/src/com/android/photos/BitmapRegionTileSource.java
@@ -245,6 +245,9 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource {
try {
ei.readExif(mPath);
return true;
+ } catch (NullPointerException e) {
+ Log.w("BitmapRegionTileSource", "reading exif failed", e);
+ return false;
} catch (IOException e) {
Log.w("BitmapRegionTileSource", "getting decoder failed", e);
return false;
@@ -311,6 +314,9 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource {
} catch (IOException e) {
Log.e("BitmapRegionTileSource", "Failed to load URI " + mUri, e);
return false;
+ } catch (NullPointerException e) {
+ Log.e("BitmapRegionTileSource", "Failed to read EXIF for URI " + mUri, e);
+ return false;
} finally {
Utils.closeSilently(is);
}
diff --git a/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java b/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
index b9b87b1..98faa88 100644
--- a/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
+++ b/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
@@ -271,6 +271,9 @@ public class WallpaperCropActivity extends Activity {
}
} catch (IOException e) {
Log.w(LOGTAG, "Getting exif data failed", e);
+ } catch (NullPointerException e) {
+ // Sometimes the ExifInterface has an internal NPE if Exif data isn't valid
+ Log.w(LOGTAG, "Getting exif data failed", e);
} finally {
Utils.closeSilently(bis);
Utils.closeSilently(is);