]> source.dussan.org Git - aspectj.git/commitdiff
defensively supplying ISourceLocation.NO_FILE when there is no file in the result.
authorwisberg <wisberg>
Wed, 14 May 2003 05:35:38 +0000 (05:35 +0000)
committerwisberg <wisberg>
Wed, 14 May 2003 05:35:38 +0000 (05:35 +0000)
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.

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java

index 3f917023778e6e0accbf25857f7bea92b6d701f7..43f2b8ee3988ad6b6e742b73cbfddefd16fdd844 100644 (file)
@@ -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;
        }