From d113478931576931ef374f55410752f502cacd3b Mon Sep 17 00:00:00 2001 From: Jin Park Date: Thu, 27 Jul 2017 14:51:09 +0900 Subject: [PATCH] ExifInterface: Remove throwing exception ExifInterface reads the first 5000 bytes of an image file to determine what type of image it is, and throws an EOFException if the file is smaller 5000 bytes. This CL removes the throwing action. Bug: 64133582 Test: Run ExifInterfaceTest.java with <5kb file Change-Id: I2b2026f06d70a4fe2986d2e8c410679ba9bf3f7f --- media/java/android/media/ExifInterface.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java index 6677178514e02..59597af55085b 100644 --- a/media/java/android/media/ExifInterface.java +++ b/media/java/android/media/ExifInterface.java @@ -2101,9 +2101,7 @@ public class ExifInterface { private int getMimeType(BufferedInputStream in) throws IOException { in.mark(SIGNATURE_CHECK_SIZE); byte[] signatureCheckBytes = new byte[SIGNATURE_CHECK_SIZE]; - if (in.read(signatureCheckBytes) != SIGNATURE_CHECK_SIZE) { - throw new EOFException(); - } + in.read(signatureCheckBytes); in.reset(); if (isJpegFormat(signatureCheckBytes)) { return IMAGE_TYPE_JPEG;