Skip to content

Commit

Permalink
Use URI.create for normal file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
milesziemer committed Jun 12, 2024
1 parent a35f6e0 commit 6852584
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.util.logging.Logger;

/**
Expand Down Expand Up @@ -42,12 +43,12 @@ public static String toPath(String uri) {
* correct scheme for jars
*/
public static String toUri(String path) {
if (path.startsWith("/")) {
return "file://" + path;
} else if (path.startsWith("jar:file")) {
if (path.startsWith("jar:file")) {
return path.replaceFirst("jar:file", "smithyjar");
} else {
} else if (path.startsWith("smithyjar:")) {
return path;
} else {
return Paths.get(path).toUri().toString();
}
}

Expand Down

0 comments on commit 6852584

Please sign in to comment.