aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-05-14 05:35:38 +0000
committerwisberg <wisberg>2003-05-14 05:35:38 +0000
commit1945ac7ed08422066ef424810ba012739ce0f934 (patch)
treef373a37304d9d984e12e68cb28098a25d3790749 /org.aspectj.ajdt.core
parent1972b16473625b96a2bf419ac113f5923f0c7093 (diff)
downloadaspectj-1945ac7ed08422066ef424810ba012739ce0f934.tar.gz
aspectj-1945ac7ed08422066ef424810ba012739ce0f934.zip
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.
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java8
1 files changed, 7 insertions, 1 deletions
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;
}