]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorSimon Brandhof <simon.brandhof@gmail.com>
Mon, 7 Oct 2013 10:56:22 +0000 (12:56 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Mon, 7 Oct 2013 10:56:22 +0000 (12:56 +0200)
sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceType.java
sonar-server/src/main/java/org/sonar/server/db/migrations/violation/ViolationConverters.java
sonar-server/src/main/java/org/sonar/server/db/migrations/violation/ViolationMigration.java
sonar-server/src/main/java/org/sonar/server/platform/Platform.java

index b5511604f0dd54dbb06e8d3a4c49cd504fc777f0..573679e95a4d8e6240942abc07ef29d050d3a294 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.api.resources;
 
-import com.google.common.annotations.Beta;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
 import com.google.common.collect.Maps;
index ffd00776fe5fe2660717a6cb964b77e2ef175784..3115472e1b58ba7560b236b0280bb32ea4c668dd 100644 (file)
@@ -38,7 +38,7 @@ class ViolationConverters {
     this.settings = settings;
   }
 
-  void execute(Referentials referentials, Database db) throws Exception {
+  void execute(Referentials referentials, Database db) throws ExecutionException, InterruptedException {
     Progress progress = new Progress(referentials.totalViolations());
 
     List<Callable<Object>> converters = Lists.newArrayList();
index 88c60a8e81525713d244267ca104f9aba9b3b727..5be57ab8a8d8cc77a6f8a456b656ecfdc4a2902f 100644 (file)
@@ -27,12 +27,14 @@ import org.sonar.core.persistence.Database;
 import org.sonar.server.db.migrations.DatabaseMigration;
 
 import java.sql.SQLException;
+import java.util.concurrent.ExecutionException;
 
 /**
  * Used in the Active Record Migration 401
  */
 public class ViolationMigration implements DatabaseMigration {
 
+  private static final String FAILURE_MESSAGE = "Fail to convert violations to issues";
   private final Settings settings;
 
   private Logger logger = LoggerFactory.getLogger(ViolationMigration.class);
@@ -49,17 +51,17 @@ public class ViolationMigration implements DatabaseMigration {
       migrate();
 
     } catch (SQLException e) {
-      logger.error("Fail to convert violations to issues", e);
+      logger.error(FAILURE_MESSAGE, e);
       SqlUtil.log(logger, e);
-      throw MessageException.of("Fail to convert violations to issues");
+      throw MessageException.of(FAILURE_MESSAGE);
 
     } catch (Exception e) {
-      logger.error("Fail to convert violations to issues", e);
-      throw MessageException.of("Fail to convert violations to issues");
+      logger.error(FAILURE_MESSAGE, e);
+      throw MessageException.of(FAILURE_MESSAGE);
     }
   }
 
-  public void migrate() throws Exception {
+  public void migrate() throws SQLException, ExecutionException, InterruptedException {
     logger.info("Initialize input");
     Referentials referentials = new Referentials(db);
 
index 9a05474f3def9667953a1791a35584c992ccd8e5..152cbff94ac2c158bcf9cc547b67a164f82f5829 100644 (file)
@@ -140,8 +140,8 @@ public final class Platform {
 
   public void init(ServletContext servletContext) {
     if (!connected) {
-        startDatabaseConnectors(servletContext);
-        connected = true;
+      startDatabaseConnectors(servletContext);
+      connected = true;
     }
   }