From 6e3113302f180c8b9ec823724835872d36b4e3ca Mon Sep 17 00:00:00 2001 From: Jin Seok Park Date: Thu, 30 May 2019 14:22:51 +0900 Subject: Catch OutOfMemoryError and log warning Bug: 133827762 Test: atest CtsMediaTestCases:android.media.cts.ExifInterfaceTest Change-Id: I5c6e247136e033968f418a50276971a8a686e021 --- media/java/android/media/ExifInterface.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java index d83cd9699466..3e3ab0882b5f 100644 --- a/media/java/android/media/ExifInterface.java +++ b/media/java/android/media/ExifInterface.java @@ -1790,15 +1790,13 @@ public class ExifInterface { // Set thumbnail image offset and length setThumbnailData(inputStream); mIsSupportedFile = true; - } catch (IOException e) { + } catch (IOException | OutOfMemoryError e) { // Ignore exceptions in order to keep the compatibility with the old versions of // ExifInterface. mIsSupportedFile = false; - if (DEBUG) { - Log.d(TAG, "Invalid image: ExifInterface got an unsupported image format file" - + "(ExifInterface supports JPEG and some RAW image formats only) " - + "or a corrupted JPEG file to ExifInterface.", e); - } + Log.w(TAG, "Invalid image: ExifInterface got an unsupported image format file" + + "(ExifInterface supports JPEG and some RAW image formats only) " + + "or a corrupted JPEG file to ExifInterface.", e); } finally { addDefaultValuesForCompatibility(); -- cgit v1.2.3-59-g8ed1b