src/java.base/share/classes/java/util/jar/JarFile.java
Print this page
@@ -35,11 +35,10 @@
import java.security.CodeSigner;
import java.security.cert.Certificate;
import java.security.AccessController;
import java.security.CodeSource;
import jdk.internal.misc.SharedSecrets;
-import sun.misc.IOUtils;
import sun.security.action.GetPropertyAction;
import sun.security.util.ManifestEntryVerifier;
import sun.security.util.SignatureFileVerifier;
/**
@@ -436,11 +435,16 @@
* Reads all the bytes for a given entry. Used to process the
* META-INF files.
*/
private byte[] getBytes(ZipEntry ze) throws IOException {
try (InputStream is = super.getInputStream(ze)) {
- return IOUtils.readFully(is, (int)ze.getSize(), true);
+ int len = (int)ze.getSize();
+ byte[] b = is.readAllBytes();
+ if (len != -1 && b.length != len)
+ throw new EOFException("Expected:" + len + ", read:" + b.length);
+
+ return b;
}
}
/**
* Returns an input stream for reading the contents of the specified