Merge branch '2.5.x'

Closes gh-28357
pull/28361/head
Phillip Webb 3 years ago
commit bcef8ee4c9

@ -91,6 +91,8 @@ public class JarFile extends AbstractJarFile implements Iterable<java.util.jar.J
private volatile boolean closed;
private volatile JarFileWrapper wrapper;
/**
* Create a new {@link JarFile} backed by the specified file.
* @param file the root jar file
@ -183,6 +185,15 @@ public class JarFile extends AbstractJarFile implements Iterable<java.util.jar.J
};
}
JarFileWrapper getWrapper() throws IOException {
JarFileWrapper wrapper = this.wrapper;
if (wrapper == null) {
wrapper = new JarFileWrapper(this);
this.wrapper = wrapper;
}
return wrapper;
}
@Override
Permission getPermission() {
return new FilePermission(this.rootFile.getFile().getPath(), READ_ACTION);

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -263,7 +263,7 @@ final class JarURLConnection extends java.net.JarURLConnection {
&& !jarFile.containsEntry(jarEntryName.toString())) {
return NOT_FOUND_CONNECTION;
}
return new JarURLConnection(url, new JarFileWrapper(jarFile), jarEntryName);
return new JarURLConnection(url, jarFile.getWrapper(), jarEntryName);
}
private static int indexOfRootSpec(StringSequence file, String pathFromRoot) {

Loading…
Cancel
Save