Merge branch '2.7.x'

Closes gh-32086
This commit is contained in:
Phillip Webb 2022-08-15 17:59:28 -07:00
commit ee2bd9e065
1 changed files with 1 additions and 14 deletions

View File

@ -26,11 +26,8 @@ import java.net.URL;
import java.net.URLStreamHandler; import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory; import java.net.URLStreamHandlerFactory;
import java.security.Permission; import java.security.Permission;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Spliterator; import java.util.Spliterator;
import java.util.Spliterators; import java.util.Spliterators;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -96,8 +93,6 @@ public class JarFile extends AbstractJarFile implements Iterable<java.util.jar.J
private volatile JarFileWrapper wrapper; private volatile JarFileWrapper wrapper;
private final List<JarFile> nestedJars = Collections.synchronizedList(new ArrayList<>());
/** /**
* Create a new {@link JarFile} backed by the specified file. * Create a new {@link JarFile} backed by the specified file.
* @param file the root jar file * @param file the root jar file
@ -340,10 +335,8 @@ public class JarFile extends AbstractJarFile implements Iterable<java.util.jar.J
+ "mechanism used to create your executable jar file"); + "mechanism used to create your executable jar file");
} }
RandomAccessData entryData = this.entries.getEntryData(entry.getName()); RandomAccessData entryData = this.entries.getEntryData(entry.getName());
JarFile nestedJar = new JarFile(this.rootFile, this.pathFromRoot + "!/" + entry.getName(), entryData, return new JarFile(this.rootFile, this.pathFromRoot + "!/" + entry.getName(), entryData,
JarFileType.NESTED_JAR); JarFileType.NESTED_JAR);
this.nestedJars.add(nestedJar);
return nestedJar;
} }
@Override @Override
@ -368,12 +361,6 @@ public class JarFile extends AbstractJarFile implements Iterable<java.util.jar.J
if (this.type == JarFileType.DIRECT) { if (this.type == JarFileType.DIRECT) {
this.rootFile.close(); this.rootFile.close();
} }
if (this.wrapper != null) {
this.wrapper.close();
}
for (JarFile nestedJar : this.nestedJars) {
nestedJar.close();
}
this.closed = true; this.closed = true;
} }
} }