|
20 | 20 | package org.sonarqube.gradle; |
21 | 21 |
|
22 | 22 | import java.io.File; |
| 23 | +import java.io.IOException; |
23 | 24 | import java.nio.file.Path; |
24 | 25 | import java.nio.file.Paths; |
25 | 26 | import java.util.ArrayList; |
@@ -411,33 +412,29 @@ public static String constructPrefixedProjectName(String projectPath) { |
411 | 412 | * Returns the collection of Java and Java FX runtime jars, if available. |
412 | 413 | */ |
413 | 414 | public static Collection<File> getRuntimeJars() { |
414 | | - return Stream.of(getRuntimeJar(), getFxRuntimeJar()).filter(Objects::nonNull).collect(Collectors.toList()); |
415 | | - } |
416 | | - |
417 | | - @Nullable |
418 | | - private static File getRuntimeJar() { |
419 | 415 | try { |
420 | | - final File javaBase = new File(System.getProperty("java.home")).getCanonicalFile(); |
421 | | - return Stream.of(new File(javaBase, "lib/rt.jar"), new File(javaBase, "jre/lib/rt.jar")) |
422 | | - .filter(File::exists) |
423 | | - .findFirst() |
424 | | - .orElse(null); |
425 | | - } catch (Exception e) { |
| 416 | + return Stream.of(getRuntimeJar(), getFxRuntimeJar()).filter(Objects::nonNull).collect(Collectors.toList()); |
| 417 | + } catch (IOException e) { |
426 | 418 | throw new IllegalStateException(e); |
427 | 419 | } |
428 | 420 | } |
429 | 421 |
|
430 | 422 | @Nullable |
431 | | - private static File getFxRuntimeJar() { |
432 | | - try { |
433 | | - final File javaBase = new File(System.getProperty("java.home")).getCanonicalFile(); |
434 | | - return Stream.of(new File(javaBase, "lib/ext/jfxrt.jar"), new File(javaBase, "jre/lib/ext/jfxrt.jar")) |
435 | | - .filter(File::exists) |
436 | | - .findFirst() |
437 | | - .orElse(null); |
438 | | - } catch (Exception e) { |
439 | | - throw new IllegalStateException(e); |
440 | | - } |
| 423 | + private static File getRuntimeJar() throws IOException { |
| 424 | + final File javaBase = new File(System.getProperty("java.home")).getCanonicalFile(); |
| 425 | + return Stream.of(new File(javaBase, "lib/rt.jar"), new File(javaBase, "jre/lib/rt.jar")) |
| 426 | + .filter(File::exists) |
| 427 | + .findFirst() |
| 428 | + .orElse(null); |
| 429 | + } |
| 430 | + |
| 431 | + @Nullable |
| 432 | + private static File getFxRuntimeJar() throws IOException { |
| 433 | + final File javaBase = new File(System.getProperty("java.home")).getCanonicalFile(); |
| 434 | + return Stream.of(new File(javaBase, "lib/ext/jfxrt.jar"), new File(javaBase, "jre/lib/ext/jfxrt.jar")) |
| 435 | + .filter(File::exists) |
| 436 | + .findFirst() |
| 437 | + .orElse(null); |
441 | 438 | } |
442 | 439 |
|
443 | 440 | } |
0 commit comments