Skip to content

Commit b7cb938

Browse files
committed
Fix error in JDK URL regex
Java regex matches the full string by default, so we need to prepend with .*, and it needs to be non-greedy so that the optional .tar portion also matches as desired.
1 parent 2ac04d4 commit b7cb938

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/scijava/launcher/Java.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public static void upgrade(BiConsumer<String, Double> subscriber)
300300

301301
// Create a temp file to house the downloaded Java archive.
302302
String prefix = Java.class.getName() + "-";
303-
Matcher m = Pattern.compile("((\\.tar)?\\.[^.]*)$").matcher(javaLink);
303+
Matcher m = Pattern.compile(".*?((\\.tar)?\\.[^.]*)$").matcher(javaLink);
304304
String suffix = m.matches() ? m.group(1) : null;
305305
File tmpArchive = Files.createTempFile(prefix, suffix).toFile();
306306
tmpArchive.deleteOnExit();

0 commit comments

Comments
 (0)