From: wisberg Date: Mon, 5 May 2003 15:08:55 +0000 (+0000) Subject: NPE guard - client of getSourceLocation only uses files - enforcing that. X-Git-Tag: V1_1_0_RC2~77 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=779e49fb268f8e90442e5260289d882cfc945e08;p=aspectj.git NPE guard - client of getSourceLocation only uses files - enforcing that. (ajcTests.xml -emacssym passes) --- 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;