Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorAndrew Gvozdev2009-07-10 17:59:05 +0000
committerAndrew Gvozdev2009-07-10 17:59:05 +0000
commit1f5127784d38d1849ca71ea57ab8e4fa4474bd21 (patch)
tree6ef496dd64156fedb98ecd47fc1b5837751b539c /codan
parent73778a328688236534cd6518fe16df0a07934d68 (diff)
downloadorg.eclipse.cdt-1f5127784d38d1849ca71ea57ab8e4fa4474bd21.tar.gz
org.eclipse.cdt-1f5127784d38d1849ca71ea57ab8e4fa4474bd21.tar.xz
org.eclipse.cdt-1f5127784d38d1849ca71ea57ab8e4fa4474bd21.zip
bug 278779: CodanProblemReporter creates duplicate markers
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanProblemReporter.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanProblemReporter.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanProblemReporter.java
index 1205eac8bd2..7b5bb830ccd 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanProblemReporter.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanProblemReporter.java
@@ -33,6 +33,19 @@ public class CodanProblemReporter {
if (problem.isEnabled() == false)
return; // skip
int severity = problem.getSeverity().intValue();
+ // Do not put in duplicates
+ IMarker[] cur = file.findMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, false, IResource.DEPTH_ZERO);
+ if (cur != null) {
+ for (IMarker element : cur) {
+ int line = ((Integer) element.getAttribute(IMarker.LINE_NUMBER)).intValue();
+ if (line==lineNumber) {
+ String mesg = (String) element.getAttribute(IMarker.MESSAGE);
+ int sev = ((Integer) element.getAttribute(IMarker.SEVERITY)).intValue();
+ if (sev == severity && mesg.equals(message))
+ return;
+ }
+ }
+ }
IMarker marker = file
.createMarker(GENERIC_CODE_ANALYSIS_MARKER_TYPE);
marker.setAttribute(IMarker.MESSAGE, message);

Back to the top