Merge branch 'fault-tolerant' of https://github.com/rsalvador/pmd
This commit is contained in:
@ -8,6 +8,8 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.sourceforge.pmd.benchmark.Benchmark;
|
||||
import net.sourceforge.pmd.benchmark.Benchmarker;
|
||||
@ -29,6 +31,8 @@ import net.sourceforge.pmd.util.filter.Filters;
|
||||
//FUTURE Implement Cloneable and clone()
|
||||
public class RuleSet {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(RuleSet.class.getName());
|
||||
|
||||
private List<Rule> rules = new ArrayList<Rule>();
|
||||
private String fileName;
|
||||
private String name = "";
|
||||
@ -207,12 +211,18 @@ public class RuleSet {
|
||||
public void apply(List<? extends Node> acuList, RuleContext ctx) {
|
||||
long start = System.nanoTime();
|
||||
for (Rule rule : rules) {
|
||||
if (!rule.usesRuleChain() && applies(rule, ctx.getLanguageVersion())) {
|
||||
rule.apply(acuList, ctx);
|
||||
long end = System.nanoTime();
|
||||
Benchmarker.mark(Benchmark.Rule, rule.getName(), end - start, 1);
|
||||
start = end;
|
||||
}
|
||||
try {
|
||||
if (!rule.usesRuleChain() && applies(rule, ctx.getLanguageVersion())) {
|
||||
rule.apply(acuList, ctx);
|
||||
long end = System.nanoTime();
|
||||
Benchmarker.mark(Benchmark.Rule, rule.getName(), end - start, 1);
|
||||
start = end;
|
||||
}
|
||||
} catch (ThreadDeath td) {
|
||||
throw td;
|
||||
} catch (Throwable t) {
|
||||
LOG.log(Level.WARNING, "Exception applying rule " + rule.getName() + ", continuing with next rule", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,9 +150,7 @@ public class ClassTypeResolver extends JavaParserVisitorAdapter {
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
LOG.log(Level.FINE, "Could not find class " + className + ", due to: " + e.getClass().getName() + ": " + e.getMessage());
|
||||
} catch (NoClassDefFoundError e) {
|
||||
LOG.log(Level.WARNING, "Could not find class " + className + ", due to: " + e.getClass().getName() + ": " + e.getMessage());
|
||||
} catch (ClassFormatError e) {
|
||||
} catch (LinkageError e) {
|
||||
LOG.log(Level.WARNING, "Could not find class " + className + ", due to: " + e.getClass().getName() + ": " + e.getMessage());
|
||||
} finally {
|
||||
populateImports(node);
|
||||
@ -636,9 +634,7 @@ public class ClassTypeResolver extends JavaParserVisitorAdapter {
|
||||
myType = pmdClassLoader.loadClass(qualifiedName);
|
||||
} catch (ClassNotFoundException e) {
|
||||
myType = processOnDemand(qualifiedName);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
myType = processOnDemand(qualifiedName);
|
||||
} catch (ClassFormatError e) {
|
||||
} catch (LinkageError e) {
|
||||
myType = processOnDemand(qualifiedName);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user