1 19 20 package edu.umd.cs.findbugs; 21 22 import edu.umd.cs.findbugs.filter.Matcher; 23 24 public class FilterBugReporter extends DelegatingBugReporter { 25 private static final boolean DEBUG = SystemProperties.getBoolean("filter.debug"); 26 27 private Matcher filter; 28 private boolean include; 29 30 public FilterBugReporter(BugReporter realBugReporter, Matcher filter, boolean include) { 31 super(realBugReporter); 32 this.filter = filter; 33 this.include = include; 34 } 35 36 @Override 37 public void reportBug(BugInstance bugInstance) { 38 if (DEBUG) System.out.print("Match ==> "); 39 boolean match = filter.match(bugInstance); 40 if (DEBUG) System.out.println(match ? "YES" : "NO"); 41 if ((include && match) || (!include && !match)) 42 getDelegate().reportBug(bugInstance); 43 } 44 } 45 46 | Popular Tags |