Skip to main content
summaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorNathan Ridge2015-03-07 02:06:12 -0500
committerGerrit Code Review @ Eclipse.org2015-03-08 14:36:13 -0400
commit5d2f7bcb56bc4d61a97e2c248d8c573540cc80a5 (patch)
tree2d80d8e18a76011a55c6b8031108ef739879adb6 /codan
parentad308251da1de7cbb3c48a52ba0d11d4d06544d2 (diff)
downloadorg.eclipse.cdt-5d2f7bcb56bc4d61a97e2c248d8c573540cc80a5.tar.gz
org.eclipse.cdt-5d2f7bcb56bc4d61a97e2c248d8c573540cc80a5.tar.xz
org.eclipse.cdt-5d2f7bcb56bc4d61a97e2c248d8c573540cc80a5.zip
Bug 352407 - Correctly compare resource path to pattern in codan
exclusion filter Change-Id: Ic7f9740fa129bb5e05a6156f077af8a8c0d36e7b Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractCheckerWithProblemPreferences.java6
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/param/FileScopeProblemPreference.java2
-rw-r--r--codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/GrepChecker.java2
3 files changed, 5 insertions, 5 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractCheckerWithProblemPreferences.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractCheckerWithProblemPreferences.java
index c7b4314f21..54e3ffbbe5 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractCheckerWithProblemPreferences.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractCheckerWithProblemPreferences.java
@@ -79,7 +79,7 @@ public abstract class AbstractCheckerWithProblemPreferences extends AbstractChec
Collection<IProblem> refProblems = getRuntime().getCheckersRegistry().getRefProblems(this);
for (Iterator<IProblem> iterator = refProblems.iterator(); iterator.hasNext();) {
IProblem checkerProblem = iterator.next();
- if (shouldProduceProblem(getProblemById(checkerProblem.getId(), res), res.getLocation()))
+ if (shouldProduceProblem(getProblemById(checkerProblem.getId(), res), res.getFullPath()))
return true;
}
return false;
@@ -110,7 +110,7 @@ public abstract class AbstractCheckerWithProblemPreferences extends AbstractChec
@Override
public void reportProblem(String problemId, IProblemLocation loc, Object... args) {
if (shouldProduceProblem(getProblemById(problemId, loc.getFile()),
- loc.getFile().getLocation())) {
+ loc.getFile().getFullPath())) {
super.reportProblem(problemId, loc, args);
}
}
@@ -125,7 +125,7 @@ public abstract class AbstractCheckerWithProblemPreferences extends AbstractChec
* @since 2.0
*/
public void reportProblem(IProblem pr, IProblemLocation loc, Object... args) {
- if (shouldProduceProblem(pr, loc.getFile().getLocation()))
+ if (shouldProduceProblem(pr, loc.getFile().getFullPath()))
super.reportProblem(pr.getId(), loc, args);
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/param/FileScopeProblemPreference.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/param/FileScopeProblemPreference.java
index dcff77ca15..78dbf31f51 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/param/FileScopeProblemPreference.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/param/FileScopeProblemPreference.java
@@ -258,7 +258,7 @@ public class FileScopeProblemPreference extends AbstractProblemPreference {
* @return true if matches with at least one pattern in the array
*/
public boolean matchesFilter(IPath resourcePath, IPath[] paths) {
- char[] path = resourcePath.toString().toCharArray();
+ char[] path = resourcePath.makeRelative().toString().toCharArray();
for (int i = 0, length = paths.length; i < length; i++) {
char[] pattern = paths[i].toString().toCharArray();
if (CharOperation.pathMatch(pattern, path, true, '/')) {
diff --git a/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/GrepChecker.java b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/GrepChecker.java
index 9a0ec7f0ab..c14778b9bc 100644
--- a/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/GrepChecker.java
+++ b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/GrepChecker.java
@@ -51,7 +51,7 @@ public class GrepChecker extends AbstractCheckerWithProblemPreferences {
for (Iterator<IProblem> iterator = refProblems.iterator(); iterator.hasNext();) {
IProblem checkerProblem = iterator.next();
IProblem problem = getProblemById(checkerProblem.getId(), file);
- if (shouldProduceProblem(problem, file.getLocation())) {
+ if (shouldProduceProblem(problem, file.getFullPath())) {
// do something
Object[] values = (Object[]) getPreference(problem, PARAM_STRING_LIST);
if (values.length == 0)

Back to the top