]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorSimon Brandhof <simon.brandhof@gmail.com>
Mon, 28 May 2012 08:24:23 +0000 (10:24 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Mon, 28 May 2012 08:24:23 +0000 (10:24 +0200)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java
sonar-core/src/main/java/org/sonar/core/review/workflow/review/DefaultReview.java
sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java
sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java

index 2f16051638b8e92882e07ca6579320b7c2ea9890..a73cae6fd1625bbaf784de3156bdf3aaf60fe329 100644 (file)
@@ -42,10 +42,6 @@ public class ViolationsDecorator implements Decorator {
     return true;
   }
 
-  private boolean shouldDecorateResource(Resource resource) {
-    return true;
-  }
-
   @DependedUpon
   public List<Metric> generatesViolationsMetrics() {
     return Arrays.asList(CoreMetrics.VIOLATIONS,
@@ -57,11 +53,9 @@ public class ViolationsDecorator implements Decorator {
   }
 
   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) {
index 2eda5a5dc1c6ae3ad8d0915fcc16d232a1b807d7..68989f0921ed710867fc0c38bafa8e5291dc5cdb 100644 (file)
@@ -172,7 +172,7 @@ public final class DefaultReview implements MutableReview {
     return this;
   }
 
-  public DefaultReview setPropertiesAsString(String s) {
+  public DefaultReview setPropertiesAsString(@Nullable String s) {
     this.properties = (s == null ? null : KeyValueFormat.parse(s));
     return this;
   }
index 6bb90f623d4dff68bea10b1425b203b920635cad..f54f3947ffbfd277a21b4fede5b640fff64a08d9 100644 (file)
@@ -126,12 +126,16 @@ public final class ClassLoaderUtils {
     } 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);
       }
     }
   }
index dfd615778cb51e2a79cf1f7d6bcb2d4557153913..cd4274e306b88ccf97415f9b885a661b3b2e0f5e 100644 (file)
@@ -180,7 +180,7 @@ public class HttpClient3Connector extends Connector {
         try {
           reader.close();
         } catch (Exception e) {
-          throw new RuntimeException("Fail to close HTTP stream", e);
+          // wsclient does not have logging ability -> silently ignore
         }
       }
     }