AI 144826: am: CL 144821 am: CL 144818 Bringing archive down to zero broken tests.
  Original author: jorgp
  Merged from: //branches/cupcake/...
  Original author: android-build

Automated import of CL 144826
diff --git a/libcore/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipFileTest.java b/libcore/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipFileTest.java
index 468a803..5530a2e 100644
--- a/libcore/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipFileTest.java
+++ b/libcore/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipFileTest.java
@@ -324,11 +324,9 @@
 
     @TestTargetNew(
         level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Strange test that succeeds in Android but not against RI.",
         method = "getEntry",
         args = {java.lang.String.class}
     )
-    @BrokenTest("Needs investigation. AndroidOnly?")
     public void test_getEntryLjava_lang_String_AndroidOnly() throws IOException {
         java.util.zip.ZipEntry zentry = zfile.getEntry("File1.txt");
         assertNotNull("Could not obtain ZipEntry", zentry);
@@ -336,12 +334,18 @@
         InputStream in;
 
         zentry = zfile.getEntry("testdir1");
-        assertNotNull("Could not obtain ZipEntry: testdir1", zentry);
+        assertNotNull("Must be able to obtain ZipEntry: testdir1", zentry);
         in = zfile.getInputStream(zentry);
-        assertNotNull("testdir1 should not have null input stream", in);
-        r = in.read();
-        in.close();
-        assertEquals("testdir1 should not contain data", -1, r);
+        /*
+         * Android delivers empty InputStream, RI no InputStream at all. The
+         * spec doesn't clarify this, so we need to deal with both situations.
+         */
+        int data = -1;
+        if (in != null) {
+            data = in.read();
+            in.close();
+        }
+        assertEquals("Must not be able to read directory data", -1, data);
     }
 
     @TestTargetNew(