Delombok with a relative path and in 'output to directory' mode would NPE. Fixes issue #241.

This commit is contained in:
Reinier Zwitserloot committed 2011-07-25 20:06:20 +02:00
1 parent b325214e82
commit 403f515aa2
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -175,7 +175,7 @@ public class Delombok {
try {
for (String in : args.input) {
File f = new File(in);
File f = new File(in).getAbsoluteFile();
if (f.isFile()) {
delombok.addFile(f.getParentFile(), f.getName());
} else if (f.isDirectory()) {
@@ -332,7 +332,7 @@ public class Delombok {
in.close();
}
}
public void addFile(File base, String fileName) throws IOException {
if (output != null && canonical(base).equals(canonical(output))) throw new IOException(
"DELOMBOK: Output file and input file refer to the same filesystem location. Specify a separate path for output.");
@@ -53,8 +53,8 @@ public class RunTestsViaDelombok extends AbstractRunTests {
}
});
delombok.addFile(file.getParentFile(), file.getName());
delombok.setSourcepath(file.getParentFile().getAbsolutePath());
delombok.addFile(file.getAbsoluteFile().getParentFile(), file.getName());
delombok.setSourcepath(file.getAbsoluteFile().getParent());
delombok.setWriter(result);
delombok.delombok();
}