aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-05-28 10:24:23 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2012-05-28 10:24:23 +0200
commit858b34a0652ce0a819302e69d935a3590b0f0df9 (patch)
treea37ff70d1295ad9cee7f2cb30b5e275b15ab89ad
parentbc0f9e916df183a2215e41330b3af3581c08f506 (diff)
downloadsonarqube-858b34a0652ce0a819302e69d935a3590b0f0df9.tar.gz
sonarqube-858b34a0652ce0a819302e69d935a3590b0f0df9.zip
Fix some quality flaws
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java12
-rw-r--r--sonar-core/src/main/java/org/sonar/core/review/workflow/review/DefaultReview.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java16
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java2
4 files changed, 15 insertions, 17 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java
index 2f16051638b..a73cae6fd16 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ViolationsDecorator.java
@@ -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) {
diff --git a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/DefaultReview.java b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/DefaultReview.java
index 2eda5a5dc1c..68989f0921e 100644
--- a/sonar-core/src/main/java/org/sonar/core/review/workflow/review/DefaultReview.java
+++ b/sonar-core/src/main/java/org/sonar/core/review/workflow/review/DefaultReview.java
@@ -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;
}
diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java b/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java
index 6bb90f623d4..f54f3947ffb 100644
--- a/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java
+++ b/sonar-server/src/main/java/org/sonar/server/plugins/ClassLoaderUtils.java
@@ -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);
}
}
}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java
index dfd615778cb..cd4274e306b 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java
@@ -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
}
}
}