Skip to content

Switch creation of ZipFileSystem to use a path instead of a URI #951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/amidst/clazz/real/RealClasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private static List<RealClass> readRealClassesFromJarFile(Path jarFile)
throw new FileNotFoundException("Attempted to load jar file at: " + jarFile + " but it does not exist.");
}

try (FileSystem jarContents = URIUtils.openZipFile(jarFile.toUri())){
try (FileSystem jarContents = URIUtils.openZipFile(jarFile)){
return readJarFile(jarContents);
} catch (IOException | RealClassCreationException | URISyntaxException e) {
throw new JarFileParsingException("Error extracting jar data.", e);
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/amidst/parsing/URIUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.net.URL;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.util.HashMap;
import java.nio.file.Path;

import amidst.documentation.Immutable;

Expand Down Expand Up @@ -55,8 +55,7 @@ public static byte[] readBytes(URL url) throws IOException {
return bytes.toByteArray();
}

public static FileSystem openZipFile(URI uri) throws URISyntaxException, IOException {
URI zipUri = new URI("jar:" + uri.getScheme(), uri.getPath(), null);
return FileSystems.newFileSystem(zipUri, new HashMap<>());
public static FileSystem openZipFile(Path path) throws URISyntaxException, IOException {
return FileSystems.newFileSystem(path, null);
}
}