Skip to content

Commit 40d194c

Browse files
authored
Fix Path bug (#3810)
2 parents de3eae7 + b078578 commit 40d194c

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

key.core/src/main/java/de/uka/ilkd/key/proof/io/UrlRuleSource.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ public Path file() {
6161
try {
6262
return Paths.get(uri);
6363
} catch (FileSystemNotFoundException e) {
64-
URI rootFs = URI.create(StringUtil.takeUntil(uri.toString(), "\\!"));
65-
String internal = StringUtil.takeAfter(uri.toString(), "\\!");
66-
try (FileSystem zipfs = FileSystems.newFileSystem(rootFs, new HashMap<>())) {
67-
return zipfs.getPath(internal);
68-
}
64+
URI rootFs = URI.create(StringUtil.takeUntil(uri.toString(), "!"));
65+
String internal = StringUtil.takeAfter(uri.toString(), "!");
66+
// keep the file system open.
67+
FileSystem zipfs = FileSystems.newFileSystem(rootFs, new HashMap<>());
68+
return zipfs.getPath(internal);
6969
}
7070
} catch (URISyntaxException | IOException e) {
7171
throw new RuntimeException(e);

key.util/src/main/java/org/key_project/util/java/StringUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,14 +504,14 @@ public static String move(@NonNull String text, int line, int charPositionInLine
504504

505505
/// Returns the string until the first match of the given regex.
506506
public static String takeUntil(String content, String regex) {
507-
var array = content.split(regex, 1);
507+
var array = content.split(regex, 2);
508508
return array[0];
509509
}
510510

511511
/// Returns the string after the first match of the given regex.
512512
public static String takeAfter(String content, String regex) {
513-
var array = content.split(regex, 1);
514-
return array[0];
513+
var array = content.split(regex, 2);
514+
return array[1];
515515
}
516516

517517

0 commit comments

Comments
 (0)