]> source.dussan.org Git - sonarqube.git/commitdiff
Fix Quality flaws
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 5 Sep 2017 14:14:25 +0000 (16:14 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 5 Sep 2017 14:14:25 +0000 (16:14 +0200)
server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java
server/sonar-main/src/main/java/org/sonar/application/cluster/HazelcastCluster.java
server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsMonitor.java
server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java

index 05815aed2b5f64db97ca0a65895bcb8d1e01e3ab..f36ff2c2251fcc5eb14374f1249bde0c687910cb 100644 (file)
@@ -172,7 +172,7 @@ public class CeServer implements Monitored {
           Thread.sleep(CHECK_FOR_STOP_DELAY);
         } catch (InterruptedException e) {
           // ignore the interruption itself
-          // Do not propagate the isInterrupted flag with : Thread.currentThread().interrupt();
+          // Do not propagate the isInterrupted flag with Thread.currentThread().interrupt()
           // It will break the shutdown of ComputeEngineContainerImpl#stop()
         }
       }
index 9cee5a621bbfb273e9558d895735f88a27248dd0..523ed681652ffe840d06cbe2915d40f126fd4f7d 100644 (file)
@@ -66,7 +66,7 @@ import static org.sonar.process.cluster.ClusterObjectKeys.OPERATIONAL_PROCESSES;
 import static org.sonar.process.cluster.ClusterObjectKeys.SONARQUBE_VERSION;
 
 public class HazelcastCluster implements AutoCloseable {
-  private static Logger LOGGER = LoggerFactory.getLogger(HazelcastCluster.class);
+  private static final Logger LOGGER = LoggerFactory.getLogger(HazelcastCluster.class);
 
   private final List<AppStateListener> listeners = new ArrayList<>();
   private final ReplicatedMap<ClusterProcess, Boolean> operationalProcesses;
index 1c64ade4c1bb3bb2c2e454b0f9e2a8222fbf8670..fcc3ccb32e25ae64d827b8e2703e3c9aef68da88 100644 (file)
@@ -126,7 +126,6 @@ public class EsMonitor extends BaseMonitorMBean implements EsMonitorMBean {
       nodeAttributes.put("Request Circuit Breaker Estimation", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.REQUEST).getEstimated()));
       nodeAttributes.put("Query Cache Memory", byteCountToDisplaySize(stats.getIndices().getQueryCache().getMemorySizeInBytes()));
       nodeAttributes.put("Request Cache Memory", byteCountToDisplaySize(stats.getIndices().getRequestCache().getMemorySizeInBytes()));
-      nodeAttributes.put("Query Cache Memory", byteCountToDisplaySize(stats.getIndices().getQueryCache().getMemorySizeInBytes()));
     }
     return nodes;
   }
index 1752bbd4c970a844fc209d211df34cdded7e446d..941cc2835bfdc79dd5d5e70ea0c2205c26e13609 100644 (file)
@@ -82,9 +82,12 @@ public class RuleCreator {
 
     RuleKey customRuleKey = RuleKey.of(templateRule.getRepositoryKey(), newRule.ruleKey());
 
-    loadRule(customRuleKey, dbSession)
-      .map(existingRule -> updateExistingRule(existingRule, newRule, dbSession))
-      .orElseGet(() -> createCustomRule(customRuleKey, newRule, templateRule, dbSession));
+    Optional<RuleDefinitionDto> definition = loadRule(customRuleKey, dbSession);
+    if (definition.isPresent()) {
+      updateExistingRule(definition.get(), newRule, dbSession);
+    } else {
+      createCustomRule(customRuleKey, newRule, templateRule, dbSession);
+    }
 
     ruleIndexer.commitAndIndex(dbSession, customRuleKey);
     return customRuleKey;