OSDN Git Service

print image path when setup error in Exif test
authorEarl Ou <shunhsingou@google.com>
Fri, 19 Oct 2012 08:49:34 +0000 (16:49 +0800)
committerEarl Ou <shunhsingou@google.com>
Wed, 31 Oct 2012 02:14:06 +0000 (10:14 +0800)
Change-Id: Ia4391571695ea518eac53f2b8c6b1a2acb5159c1

tests/src/com/android/gallery3d/exif/ExifXmlDataTestCase.java

index 5b61778..6a4d29e 100644 (file)
@@ -63,15 +63,19 @@ public class ExifXmlDataTestCase extends InstrumentationTestCase {
 
     @Override
     public void setUp() throws Exception {
-        if (mImagePath != null) {
-            mImageInputStream = new FileInputStream(mImagePath);
-            mXmlInputStream = new FileInputStream(mXmlPath);
-            mXmlParser = Xml.newPullParser();
-            mXmlParser.setInput(new InputStreamReader(mXmlInputStream));
-        } else {
-            Resources res = getInstrumentation().getContext().getResources();
-            mImageInputStream = res.openRawResource(mImageResourceId);
-            mXmlParser = res.getXml(mXmlResourceId);
+        try {
+            if (mImagePath != null) {
+                mImageInputStream = new FileInputStream(mImagePath);
+                mXmlInputStream = new FileInputStream(mXmlPath);
+                mXmlParser = Xml.newPullParser();
+                mXmlParser.setInput(new InputStreamReader(mXmlInputStream));
+            } else {
+                Resources res = getInstrumentation().getContext().getResources();
+                mImageInputStream = res.openRawResource(mImageResourceId);
+                mXmlParser = res.getXml(mXmlResourceId);
+            }
+        } catch (Exception e) {
+            throw new Exception(getImageTitle(), e);
         }
     }