Revert r823479 to fix HARMONY-6381 ([classlib][rmi] Regression in test RMIClassLoaderTest.testLoadClassCodebaseOrder)


git-svn-id: https://svn.apache.org/repos/asf/harmony/enhanced/classlib/trunk@883524 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/modules/archive/src/main/java/java/util/jar/JarFile.java b/modules/archive/src/main/java/java/util/jar/JarFile.java
index 83ced23..0fabd60 100644
--- a/modules/archive/src/main/java/java/util/jar/JarFile.java
+++ b/modules/archive/src/main/java/java/util/jar/JarFile.java
@@ -339,11 +339,15 @@
         }
         try {
             InputStream is = super.getInputStream(manifestEntry);
-            byte[] buffer = getAllBytesFromStreamAndClose(is);
             if (verifier != null) {
-                verifier.addMetaEntry(manifestEntry.getName(), buffer);
+                verifier.addMetaEntry(manifestEntry.getName(), getAllBytesFromStreamAndClose(is));
+                is = super.getInputStream(manifestEntry);
             }
-            manifest = new Manifest(buffer, verifier != null);
+            try {
+                manifest = new Manifest(is, verifier != null);
+            } finally {
+                is.close();
+            }
             manifestEntry = null;  // Can discard the entry now.
         } catch (NullPointerException e) {
             manifestEntry = null;
diff --git a/modules/archive/src/main/java/java/util/jar/Manifest.java b/modules/archive/src/main/java/java/util/jar/Manifest.java
index 198d0be..7f6437d 100644
--- a/modules/archive/src/main/java/java/util/jar/Manifest.java
+++ b/modules/archive/src/main/java/java/util/jar/Manifest.java
@@ -115,13 +115,6 @@
         }
         read(is);
     }
-    
-    Manifest(byte[] buf, boolean readChunks) throws IOException {
-        if (readChunks) {
-            chunks = new HashMap<String, Chunk>();
-        }
-        initFromBytes(buf);
-    }
 
     /**
      * Resets the both the main attributes as well as the entry attributes
@@ -233,13 +226,6 @@
             buf[buf.length - 1] = '\n';
         }
 
-        initFromBytes(buf);
-    }
-
-    void initFromBytes(byte[] buf) throws IOException {
-        if (buf.length == 0) {
-            return;
-        }
         // Attributes.Name.MANIFEST_VERSION is not used for
         // the second parameter for RI compatibility
         im = new InitManifest(buf, mainAttributes, null);