]> source.dussan.org Git - aspectj.git/commitdiff
NPE guard - client of getSourceLocation only uses files - enforcing that.
authorwisberg <wisberg>
Mon, 5 May 2003 15:08:55 +0000 (15:08 +0000)
committerwisberg <wisberg>
Mon, 5 May 2003 15:08:55 +0000 (15:08 +0000)
(ajcTests.xml -emacssym passes)

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java

index 4c19219aae9b4fd292adf2540b7e8b764c5e71d0..1b62830861a8150d5cf2f34c2b3ae06f9a9d3572 100644 (file)
@@ -65,6 +65,12 @@ public class EmacsStructureModelManager {
 //    }
 
     private void dumpStructureToFile(ProgramElementNode node) throws IOException {
+        String s = node.getKind();
+        if (!  (s.equals(ProgramElementNode.Kind.FILE_ASPECTJ.toString())
+                || s.equals(ProgramElementNode.Kind.FILE_JAVA.toString()))) {
+            throw new IllegalArgumentException("externalize file, not " + node);
+        }
+        // source files have source locations
         String sourceName = node.getSourceLocation().getSourceFile().getAbsolutePath();
         String fileName = sourceName.substring(0, sourceName.lastIndexOf(".")) + EXTERN_FILE_SUFFIX;
         BufferedWriter writer = null;