From bbbe3dceac97712bfae870fca652a536e2a6d5f1 Mon Sep 17 00:00:00 2001 From: Alena Laskavaia Date: Wed, 17 Nov 2010 01:50:47 +0000 Subject: [PATCH] Bug 329858: fixing exception with header files outside of workspace --- .../core/model/CodanMarkerProblemReporter.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java index 29825e4b120..38f0639a729 100644 --- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java @@ -132,9 +132,18 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter protected Collection findResourceMarkers(IResource resource, IChecker checker) throws CoreException { Collection res = new ArrayList(); - IMarker[] markers = resource.findMarkers( - GENERIC_CODE_ANALYSIS_MARKER_TYPE, true, - IResource.DEPTH_INFINITE); + IMarker[] markers; + if (resource.exists()) { + markers = resource.findMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, + true, IResource.DEPTH_INFINITE); + } else { + if (resource.getProject() == null) + return res; + // non resource markers attached to a project itself + markers = resource.getProject().findMarkers( + GENERIC_CODE_ANALYSIS_MARKER_TYPE, true, + IResource.DEPTH_ZERO); + } ICheckersRegistry reg = CodanRuntime.getInstance() .getCheckersRegistry(); Collection problems = reg.getRefProblems(checker);