This commit is contained in:
Phillip Webb
2016-09-09 10:27:44 -07:00
parent a3c63b9c34
commit 56544c8dd5
11 changed files with 30 additions and 26 deletions

View File

@@ -260,10 +260,10 @@ public class RandomAccessDataFile implements RandomAccessData {
public void close() throws IOException {
this.available.acquireUninterruptibly(this.size);
try {
RandomAccessFile file = this.files.poll();
while (file != null) {
file.close();
file = this.files.poll();
RandomAccessFile pooledFile = this.files.poll();
while (pooledFile != null) {
pooledFile.close();
pooledFile = this.files.poll();
}
}
finally {

View File

@@ -158,12 +158,12 @@ public class Handler extends URLStreamHandler {
String path = name.substring(FILE_PROTOCOL.length());
File file = new File(URLDecoder.decode(path, "UTF-8"));
Map<File, JarFile> cache = rootFileCache.get();
JarFile jarFile = (cache == null ? null : cache.get(file));
if (jarFile == null) {
jarFile = new JarFile(file);
addToRootFileCache(file, jarFile);
JarFile result = (cache == null ? null : cache.get(file));
if (result == null) {
result = new JarFile(file);
addToRootFileCache(file, result);
}
return jarFile;
return result;
}
catch (Exception ex) {
throw new IOException("Unable to open root Jar file '" + name + "'", ex);