Skip to content

Commit 0101f57

Browse files
author
emmanue1
committed
Fix exception thrown when indexer browses a ZIP file in a ZIP file
1 parent d64f946 commit 0101f57

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

services/src/main/java/org/jd/gui/model/container/GenericContainer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,26 +146,27 @@ protected Collection<Container.Entry> loadChildrenFromDirectoryEntry() throws IO
146146
}
147147

148148
protected Collection<Container.Entry> loadChildrenFromFileEntry() throws IOException {
149-
File tmpFile = File.createTempFile("jd-gui.", ".tmp." + fsPath.getFileName().toString());
149+
File tmpFile = File.createTempFile("jd-gui.", "." + fsPath.getFileName().toString());
150150
Path tmpPath = Paths.get(tmpFile.toURI());
151151

152+
tmpFile.delete();
152153
Files.copy(fsPath, tmpPath);
154+
tmpFile.deleteOnExit();
153155

154156
FileSystem subFileSystem = FileSystems.newFileSystem(tmpPath, null);
155157

156158
if (subFileSystem != null) {
157159
Iterator<Path> rootDirectories = subFileSystem.getRootDirectories().iterator();
158160

159161
if (rootDirectories.hasNext()) {
160-
tmpFile.deleteOnExit();
161-
162162
Path rootPath = rootDirectories.next();
163163
ContainerFactory containerFactory = api.getContainerFactory(rootPath);
164164

165165
if (containerFactory != null) {
166166
Container container = containerFactory.make(api, this, rootPath);
167167

168168
if (container != null) {
169+
tmpFile.delete();
169170
return container.getRoot().getChildren();
170171
}
171172
}

0 commit comments

Comments
 (0)