1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 352407 - Correctly compare resource path to pattern in codan

exclusion filter

Change-Id: Ic7f9740fa129bb5e05a6156f077af8a8c0d36e7b
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
This commit is contained in:
Nathan Ridge 2015-03-07 02:06:12 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent ad308251da
commit 5d2f7bcb56
3 changed files with 5 additions and 5 deletions

View file

@ -79,7 +79,7 @@ public abstract class AbstractCheckerWithProblemPreferences extends AbstractChec
Collection<IProblem> refProblems = getRuntime().getCheckersRegistry().getRefProblems(this); Collection<IProblem> refProblems = getRuntime().getCheckersRegistry().getRefProblems(this);
for (Iterator<IProblem> iterator = refProblems.iterator(); iterator.hasNext();) { for (Iterator<IProblem> iterator = refProblems.iterator(); iterator.hasNext();) {
IProblem checkerProblem = iterator.next(); IProblem checkerProblem = iterator.next();
if (shouldProduceProblem(getProblemById(checkerProblem.getId(), res), res.getLocation())) if (shouldProduceProblem(getProblemById(checkerProblem.getId(), res), res.getFullPath()))
return true; return true;
} }
return false; return false;
@ -110,7 +110,7 @@ public abstract class AbstractCheckerWithProblemPreferences extends AbstractChec
@Override @Override
public void reportProblem(String problemId, IProblemLocation loc, Object... args) { public void reportProblem(String problemId, IProblemLocation loc, Object... args) {
if (shouldProduceProblem(getProblemById(problemId, loc.getFile()), if (shouldProduceProblem(getProblemById(problemId, loc.getFile()),
loc.getFile().getLocation())) { loc.getFile().getFullPath())) {
super.reportProblem(problemId, loc, args); super.reportProblem(problemId, loc, args);
} }
} }
@ -125,7 +125,7 @@ public abstract class AbstractCheckerWithProblemPreferences extends AbstractChec
* @since 2.0 * @since 2.0
*/ */
public void reportProblem(IProblem pr, IProblemLocation loc, Object... args) { 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); super.reportProblem(pr.getId(), loc, args);
} }

View file

@ -258,7 +258,7 @@ public class FileScopeProblemPreference extends AbstractProblemPreference {
* @return true if matches with at least one pattern in the array * @return true if matches with at least one pattern in the array
*/ */
public boolean matchesFilter(IPath resourcePath, IPath[] paths) { 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++) { for (int i = 0, length = paths.length; i < length; i++) {
char[] pattern = paths[i].toString().toCharArray(); char[] pattern = paths[i].toString().toCharArray();
if (CharOperation.pathMatch(pattern, path, true, '/')) { if (CharOperation.pathMatch(pattern, path, true, '/')) {

View file

@ -51,7 +51,7 @@ public class GrepChecker extends AbstractCheckerWithProblemPreferences {
for (Iterator<IProblem> iterator = refProblems.iterator(); iterator.hasNext();) { for (Iterator<IProblem> iterator = refProblems.iterator(); iterator.hasNext();) {
IProblem checkerProblem = iterator.next(); IProblem checkerProblem = iterator.next();
IProblem problem = getProblemById(checkerProblem.getId(), file); IProblem problem = getProblemById(checkerProblem.getId(), file);
if (shouldProduceProblem(problem, file.getLocation())) { if (shouldProduceProblem(problem, file.getFullPath())) {
// do something // do something
Object[] values = (Object[]) getPreference(problem, PARAM_STRING_LIST); Object[] values = (Object[]) getPreference(problem, PARAM_STRING_LIST);
if (values.length == 0) if (values.length == 0)