Skip to content

Commit

Permalink
bugfix: optimize MR-jar processing
Browse files Browse the repository at this point in the history
  • Loading branch information
lprimak committed May 13, 2024
1 parent e5c074a commit 7456a0e
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2016-2023] [Payara Foundation and/or its affiliates]
// Portions Copyright [2016-2024] [Payara Foundation and/or its affiliates]

package com.sun.enterprise.loader;

Expand Down Expand Up @@ -613,12 +613,17 @@ private byte[] loadClassData0(final URLEntry res, final String entryName) {
return AccessController.doPrivileged((PrivilegedAction<byte[]>) () -> {
try {
if (res.isJar) { // It is a jarfile..
JarFile zip = res.zip;
JarFile jar = new JarFile(res.file, false, JarFile.OPEN_READ,
Runtime.Version.parse(System.getProperty("java.version")));
JarEntry entry = jar.getJarEntry(entryName);
JarEntry entry;
if (res.zip.isMultiRelease()) {
// optimization, the below op takes time, so avoid it as necessary
entry = res.zip.getJarEntry("META-INF/versions/"
+ Runtime.Version.parse(System.getProperty("java.version")) + "/"
+ entryName);
} else {
entry = res.zip.getJarEntry(entryName);
}
if (entry != null) {
byte[] classData = getClassData(zip.getInputStream(entry));
byte[] classData = getClassData(res.zip.getInputStream(entry));
res.setProtectionDomain(ASURLClassLoader.this, entry.getCertificates());
return classData;
}
Expand Down

0 comments on commit 7456a0e

Please sign in to comment.