|
13 | 13 |
|
14 | 14 | import java.io.FileOutputStream; |
15 | 15 | import java.io.IOException; |
| 16 | +import java.nio.file.Files; |
| 17 | +import java.nio.file.Path; |
| 18 | +import java.nio.file.Paths; |
16 | 19 | import java.util.ArrayList; |
17 | 20 | import java.util.HashMap; |
18 | 21 | import java.util.List; |
@@ -47,6 +50,10 @@ public void run() { |
47 | 50 |
|
48 | 51 | private void loadClasses() throws IOException { |
49 | 52 | System.out.println("Reading JAR file: " + settings.getInputPath()); |
| 53 | + Path inputPath = Paths.get(settings.getInputPath()); |
| 54 | + if (!Files.exists(inputPath)) { |
| 55 | + throw new IOException("Input JAR file not found: " + settings.getInputPath()); |
| 56 | + } |
50 | 57 | JarFile jarFile = new JarFile(settings.getInputPath()); |
51 | 58 | jarFile.stream().forEach(entry -> { |
52 | 59 | try { |
@@ -108,6 +115,10 @@ private List<ITransformer> buildTransformers() { |
108 | 115 | private void writeOutput() throws IOException { |
109 | 116 | System.out.println("Writing JAR file: " + settings.getOutputPath()); |
110 | 117 | try (JarOutputStream jarOut = new JarOutputStream(new FileOutputStream(settings.getOutputPath()))) { |
| 118 | + Path inputPath = Paths.get(settings.getInputPath()); |
| 119 | + if (!Files.exists(inputPath)) { |
| 120 | + throw new IOException("Input JAR file not found: " + settings.getInputPath()); |
| 121 | + } |
111 | 122 | JarFile inputJar = new JarFile(settings.getInputPath()); |
112 | 123 |
|
113 | 124 | inputJar.stream().forEach(entry -> { |
|
0 commit comments