This is needed for file-based message matching to not fail when no file is specified,
and might provide a more sensible error message if the file is used.
This only replaces a NPE or invalid (empty) filename strings.
public File getSourceFile() {
if (null == file) {
- file = new File(new String(result.fileName));
+ if ((null == result)
+ || (null == result.fileName)
+ || (0 == result.fileName.length)) {
+ file = ISourceLocation.NO_FILE;
+ } else {
+ file = new File(new String(result.fileName));
+ }
}
return file;
}