From 779e49fb268f8e90442e5260289d882cfc945e08 Mon Sep 17 00:00:00 2001 From: wisberg Date: Mon, 5 May 2003 15:08:55 +0000 Subject: [PATCH] NPE guard - client of getSourceLocation only uses files - enforcing that. (ajcTests.xml -emacssym passes) --- .../internal/core/builder/EmacsStructureModelManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java index 4c19219aa..1b6283086 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java @@ -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; -- 2.39.5