Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2014-08-11 19:02:00 +0000
committerElena Laskavaia2014-08-12 12:46:41 +0000
commita458a0fe9fcd96ca7fc961488e96f3f04cc963a8 (patch)
tree2babfe176e647142ec5b1992ac5dbddea340eab7
parent4dd9a12177937e985a74b4311ee00e928a27fbdc (diff)
downloadorg.eclipse.cdt-a458a0fe9fcd96ca7fc961488e96f3f04cc963a8.tar.gz
org.eclipse.cdt-a458a0fe9fcd96ca7fc961488e96f3f04cc963a8.tar.xz
org.eclipse.cdt-a458a0fe9fcd96ca7fc961488e96f3f04cc963a8.zip
Fixing NPE in ACBuilder
ACBuilder now fails to add a marker if some other marker have no linumber attribute. Added default line and severity for marker comparision purposes. Change-Id: I9c42f660cae08c3303382d8c35aa6404e7130652 Signed-off-by: Alena Laskavaia <elaskavaia.cdt@gmail.com> Reviewed-on: https://git.eclipse.org/r/31398 Tested-by: Hudson CI
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java
index 392aa56ad73..aa56c6a94f5 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java
@@ -75,8 +75,8 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
// Try to find matching markers and don't put in duplicates
IMarker[] markers = markerResource.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_ONE);
for (IMarker m : markers) {
- int line = ((Integer) m.getAttribute(IMarker.LINE_NUMBER)).intValue();
- int sev = ((Integer) m.getAttribute(IMarker.SEVERITY)).intValue();
+ int line = m.getAttribute(IMarker.LINE_NUMBER, -1);
+ int sev = m.getAttribute(IMarker.SEVERITY, -1);
String msg = (String) m.getAttribute(IMarker.MESSAGE);
if (line == problemMarkerInfo.lineNumber && sev == mapMarkerSeverity(problemMarkerInfo.severity) && msg.equals(problemMarkerInfo.description)) {
String extloc = (String) m.getAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION);

Back to the top