return true;
}
- private boolean shouldDecorateResource(Resource resource) {
- return true;
- }
-
@DependedUpon
public List<Metric> generatesViolationsMetrics() {
return Arrays.asList(CoreMetrics.VIOLATIONS,
}
public void decorate(Resource resource, DecoratorContext context) {
- if (shouldDecorateResource(resource)) {
- computeTotalViolations(context);
- computeViolationsPerSeverities(context);
- computeViolationsPerRules(context);
- }
+ computeTotalViolations(context);
+ computeViolationsPerSeverities(context);
+ computeViolationsPerRules(context);
}
private void computeTotalViolations(DecoratorContext context) {
} catch (Exception e) {
throw Throwables.propagate(e);
} finally {
- if (jar != null) {
- try {
- jar.close();
- } catch (Exception e) {
- LoggerFactory.getLogger(ClassLoaderUtils.class).error("Fail to close JAR file: " + jarPath, e);
- }
+ closeJar(jar, jarPath);
+ }
+ }
+
+ private static void closeJar(JarFile jar, String jarPath) {
+ if (jar != null) {
+ try {
+ jar.close();
+ } catch (Exception e) {
+ LoggerFactory.getLogger(ClassLoaderUtils.class).error("Fail to close JAR file: " + jarPath, e);
}
}
}