]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality flaws
authorJulien Lancelot <julien.lancelot@gmail.com>
Thu, 29 Aug 2013 14:15:07 +0000 (16:15 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Thu, 29 Aug 2013 14:15:07 +0000 (16:15 +0200)
sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java
sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java

index 9d37ae9101c1c643a3d65dbbd7afc2a9e9bb9bc9..e2da68aeeb317fca05e150d3249739b9f4ec6fca 100644 (file)
@@ -40,8 +40,11 @@ public class DryRunDatabaseFactory implements ServerComponent {
   private static final String DIALECT = "h2";
   private static final String DRIVER = "org.h2.Driver";
   private static final String URL = "jdbc:h2:";
-  private static final String USER = "sonar";
-  private static final String PASSWORD = "sonar";
+  private static final String H2_FILE_SUFFIX = ".h2.db";
+  private static final String SONAR = "sonar";
+  private static final String USER = SONAR;
+  private static final String PASSWORD = SONAR;
+
   private final Database database;
   private final ServerFileSystem serverFileSystem;
 
@@ -62,7 +65,7 @@ public class DryRunDatabaseFactory implements ServerComponent {
       close(destination);
 
       if (LOG.isDebugEnabled()) {
-        File dbFile = new File(name + ".h2.db");
+        File dbFile = new File(name + H2_FILE_SUFFIX);
         long size = dbFile.length();
         long duration = System.currentTimeMillis() - startup;
         if (projectId == null) {
@@ -136,7 +139,7 @@ public class DryRunDatabaseFactory implements ServerComponent {
 
   private byte[] dbFileContent(String name) {
     try {
-      File dbFile = new File(name + ".h2.db");
+      File dbFile = new File(name + H2_FILE_SUFFIX);
       byte[] content = Files.toByteArray(dbFile);
       dbFile.delete();
       return content;
index d5ab2fe3acaa8cd3caab4595bf788cccab85a62b..41696ec744f7bbb6143b57f35ac6e58ac63ce543 100644 (file)
@@ -65,6 +65,7 @@ public class InternalRubyIssueService implements ServerComponent {
   private static final String ID_PARAM = "id";
   private static final String NAME_PARAM = "name";
   private static final String DESCRIPTION_PARAM = "description";
+  private static final String ACTION_PLANS_ERRORS_ACTION_PLAN_DOES_NOT_EXIST = "action_plans.errors.action_plan_does_not_exist";
 
   private final IssueService issueService;
   private final IssueCommentService commentService;
@@ -248,7 +249,7 @@ public class InternalRubyIssueService implements ServerComponent {
     DefaultActionPlan existingActionPlan = (DefaultActionPlan) actionPlanService.findByKey(key, UserSession.get());
     if (existingActionPlan == null) {
       Result<ActionPlan> result = Result.of();
-      result.addError(Result.Message.ofL10n("action_plans.errors.action_plan_does_not_exist", key));
+      result.addError(Result.Message.ofL10n(ACTION_PLANS_ERRORS_ACTION_PLAN_DOES_NOT_EXIST, key));
       return result;
     } else {
       Result<ActionPlan> result = createActionPlanResult(parameters, existingActionPlan);
@@ -362,7 +363,7 @@ public class InternalRubyIssueService implements ServerComponent {
   private Result<ActionPlan> createResultForExistingActionPlan(String actionPlanKey) {
     Result<ActionPlan> result = Result.of();
     if (findActionPlan(actionPlanKey) == null) {
-      result.addError(Result.Message.ofL10n("action_plans.errors.action_plan_does_not_exist", actionPlanKey));
+      result.addError(Result.Message.ofL10n(ACTION_PLANS_ERRORS_ACTION_PLAN_DOES_NOT_EXIST, actionPlanKey));
     }
     return result;
   }