8000 Fix CompilationHandler.uriToFilePath for jar scheme · sakerbuild/saker.java.compiler@f2e4962 · GitHub
[go: up one dir, main page]

Skip to content

Commit f2e4962

Browse files
committed
Fix CompilationHandler.uriToFilePath for jar scheme
1 parent 5d2a3de commit f2e4962

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

impl/src/main/saker/java/compiler/impl/compile/handler/CompilationHandler.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,12 +527,16 @@ public static SakerPath uriToFilePath(URI uri) {
527527
String scheme = uri.getScheme();
528528
switch (scheme) {
529529
case "jar": {
530-
String specific = uri.getSchemeSpecificPart();
531-
if (specific.startsWith("file:/")) {
532-
int idx = specific.indexOf('!');
533-
return SakerPath.valueOf(specific.substring(6, idx));
530+
try {
531+
String specific = uri.getSchemeSpecificPart();
532+
if (specific.startsWith("file:///")) {
533+
int idx = specific.indexOf('!');
534+
return SakerPath.valueOf(specific.substring(8, idx));
535+
}
536+
} catch (Exception e) {
537+
throw new IllegalArgumentException("Failed to convert URI to path: " + uri, e);
534538
}
535-
throw new RuntimeException("Unknown jar protocol: " + specific);
539+
throw new IllegalArgumentException("Failed to convert URI to path: " + uri);
536540
}
537541
case CompilationHandler.URI_SCHEME_GENERATED:
538542
case CompilationHandler.URI_SCHEME_INPUT: {

0 commit comments

Comments
 (0)
0