]> source.dussan.org Git - sonarqube.git/commitdiff
Using already-defined constants instead of duplicating their values
authorDiego Marcilio <dvmarcilio@gmail.com>
Wed, 12 Jun 2019 06:00:56 +0000 (03:00 -0300)
committerSonarTech <sonartech@sonarsource.com>
Thu, 13 Jun 2019 18:21:12 +0000 (20:21 +0200)
Fixes multiple squid:S1192 violations (only for already defined constants)

server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/RemoveViewsDefinitionFromProperties.java
server/sonar-server-common/src/main/java/org/sonar/server/platform/UrlSettings.java
server/sonar-server/src/main/java/org/sonar/server/authentication/ws/ValidateAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileBackuperImpl.java
server/sonar-server/src/main/java/org/sonar/server/user/ws/DeactivateAction.java

index bad536ddf3e803a6c3b55700589c6aa59fdb77ad..77129395c49f210d4a672df4076da0542dbf35bf 100644 (file)
@@ -116,7 +116,7 @@ public class PropertiesDao implements Dao {
     res.setString(1, projectUuid);
     int index = 2;
     for (String dispatcherKey : dispatcherKeys) {
-      res.setString(index, "notification." + dispatcherKey + ".%");
+      res.setString(index, NOTIFICATION_PREFIX + dispatcherKey + ".%");
       index++;
     }
     return res;
index e069c55574735b1c6b9dd2b5291225df4c5e27b6..0370ad27b8f0d63ff34a2ed1ce5256782f7f9aae 100644 (file)
@@ -64,7 +64,7 @@ public class RemoveViewsDefinitionFromProperties extends DataChange {
         " (?,?,?,?)")) {
         long now = system2.now();
         insert
-          .setString(1, "views.def")
+          .setString(1, VIEWS_DEFINITION_PROPERTY_KEY)
           .setBoolean(2, false)
           .setString(3, property)
           .setLong(4, now)
index 7545fa69da4ce0cedfa2e13ca66ad9fdb5940ea7..3ba9e89bc78995ef28c63ad49fcbac6059d60550 100644 (file)
@@ -68,7 +68,7 @@ public class UrlSettings {
   private String computeBaseUrl() {
     String host = config.get("sonar.web.host").orElse("");
     int port = config.getInt("sonar.web.port").orElse(0);
-    String context = config.get("sonar.web.context").orElse("");
+    String context = config.get(PROPERTY_CONTEXT).orElse("");
 
     StringBuilder res = new StringBuilder();
     res.append("http://");
index edcda3f80c9c8c5cf56efa7f29e32a9eed7fc28b..4647695654f2c8827754e89b4e70ac16a6adfe73 100644 (file)
@@ -59,7 +59,7 @@ public class ValidateAction extends ServletFilter implements AuthenticationWsAct
 
   @Override
   public void define(WebService.NewController controller) {
-    controller.createAction("validate")
+    controller.createAction(VALIDATE_ACTION)
       .setDescription("Check credentials.")
       .setSince("3.3")
       .setHandler(ServletFilterHandler.INSTANCE)
index 16fda06a01f52558c9bb92d12493d483461e9953..48658b6afd07273a0789120f4cc452996a5b7709 100644 (file)
@@ -148,7 +148,7 @@ public class QProfileBackuperImpl implements QProfileBackuper {
       SMInputFactory inputFactory = initStax();
       SMHierarchicCursor rootC = inputFactory.rootElementCursor(backup);
       rootC.advance(); // <profile>
-      if (!"profile".equals(rootC.getLocalName())) {
+      if (!ATTRIBUTE_PROFILE.equals(rootC.getLocalName())) {
         throw new IllegalArgumentException("Backup XML is not valid. Root element must be <profile>.");
       }
       SMInputCursor cursor = rootC.childElementCursor();
index 56973560f1ed3d9f2412897f563d51c85b268c6e..c53c29885bddb651a4f30a2957ca0aeaa4fd1e53 100644 (file)
@@ -74,7 +74,7 @@ public class DeactivateAction implements UsersWsAction {
       .setResponseExample(getClass().getResource("deactivate-example.json"))
       .setHandler(this);
 
-    action.createParam("login")
+    action.createParam(PARAM_LOGIN)
       .setDescription("User login")
       .setRequired(true)
       .setExampleValue("myuser");