From: wisberg Date: Wed, 14 May 2003 05:35:38 +0000 (+0000) Subject: defensively supplying ISourceLocation.NO_FILE when there is no file in the result. X-Git-Tag: V1_1_0~104 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1945ac7ed08422066ef424810ba012739ce0f934;p=aspectj.git defensively supplying ISourceLocation.NO_FILE when there is no file in the result. 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. --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java index 3f9170237..43f2b8ee3 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java @@ -42,7 +42,13 @@ public class EclipseSourceLocation implements ISourceLocation { 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; }