diff options
author | aclement <aclement> | 2004-07-28 14:43:40 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-07-28 14:43:40 +0000 |
commit | 573741c8081c6b6b45921cafaae39f37eede2302 (patch) | |
tree | fae17176ce374ed0881cb10a8a161e39b3e18fbb /org.aspectj.ajdt.core | |
parent | c143eb5ec12a8ee9cf480e8bf4a4e12acef38d40 (diff) | |
download | aspectj-573741c8081c6b6b45921cafaae39f37eede2302.tar.gz aspectj-573741c8081c6b6b45921cafaae39f37eede2302.zip |
Fix for 64331
java.lang.NullPointerException in WeaverMessageHandler class
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java index 71017a6c3..a379fccb6 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.aspectj.ajdt.internal.compiler; +import java.util.ArrayList; import java.util.List; import org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceLocation; @@ -164,12 +165,13 @@ public class WeaverMessageHandler implements IMessageHandler { private IProblem[] buildSeeAlsoProblems(List sourceLocations, CompilationResult problemSource, boolean usedBinarySourceFileName) { - int probLength = sourceLocations.size(); - if (usedBinarySourceFileName) probLength++; - IProblem[] ret = new IProblem[probLength]; + List ret = new ArrayList(); + for (int i = 0; i < sourceLocations.size(); i++) { ISourceLocation loc = (ISourceLocation) sourceLocations.get(i); - ret[i] = new DefaultProblem(loc.getSourceFile().getPath().toCharArray(), + if (loc != null ) { + DefaultProblem dp = + new DefaultProblem( loc.getSourceFile().getPath().toCharArray(), "see also", 0, new String[] {}, @@ -177,13 +179,19 @@ public class WeaverMessageHandler implements IMessageHandler { getStartPos(loc,null), getEndPos(loc,null), loc.getLine()); + ret.add(dp); + } else { + throw new RuntimeException("Internal Compiler Error: Unexpected null source location passed as 'see also' location."); + } } if (usedBinarySourceFileName) { - ret[ret.length -1] = new DefaultProblem(problemSource.fileName,"see also",0,new String[] {}, + DefaultProblem dp = new DefaultProblem(problemSource.fileName,"see also",0,new String[] {}, ProblemSeverities.Ignore,0, 0,0); + ret.add(dp); } - return ret; + IProblem[] retValue = (IProblem[])ret.toArray(new IProblem[]{}); + return retValue; } } |