ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adorosz...@apache.org
Subject ambari git commit: AMBARI-19149. Code cleanup: String concatenation in StringBuilder.append()
Date Mon, 03 Apr 2017 21:03:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 48af3ee8d -> ba63ea303


AMBARI-19149. Code cleanup: String concatenation in StringBuilder.append()


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ba63ea30
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ba63ea30
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ba63ea30

Branch: refs/heads/trunk
Commit: ba63ea303870b3091d2a512883bb0105c46dbc75
Parents: 48af3ee
Author: Attila Doroszlai <adoroszlai@hortonworks.com>
Authored: Mon Apr 3 15:25:41 2017 +0200
Committer: Attila Doroszlai <adoroszlai@hortonworks.com>
Committed: Mon Apr 3 23:04:05 2017 +0200

----------------------------------------------------------------------
 .../ambari/server/actionmanager/Stage.java      | 22 ++++++++++----------
 .../server/configuration/Configuration.java     |  2 +-
 .../ambari/server/controller/ActionRequest.java | 19 +++++++++--------
 .../server/controller/ClusterResponse.java      | 17 +++++++--------
 .../server/controller/ExecuteActionRequest.java | 16 +++++++-------
 .../server/controller/ServiceRequest.java       | 10 ++++-----
 .../server/controller/ShortTaskStatus.java      | 19 ++++++++---------
 .../ambari/server/controller/UserRequest.java   |  2 +-
 .../customactions/ActionDefinitionManager.java  |  4 ++--
 .../server/orm/helpers/dbms/PostgresHelper.java |  2 +-
 .../server/stageplanner/RoleGraphNode.java      |  2 +-
 .../apache/ambari/server/state/HostConfig.java  |  4 ++--
 .../server/state/ServiceComponentImpl.java      | 13 +++++++-----
 .../apache/ambari/server/state/ServiceImpl.java | 10 +++++----
 .../server/topology/BlueprintValidatorImpl.java |  2 +-
 .../ganglia/GangliaPropertyProviderTest.java    |  6 +++---
 .../RangerWebAlertConfigActionTest.java         |  2 +-
 17 files changed, 77 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
index cca279b..a46e6a2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
@@ -930,19 +930,19 @@ public class Stage {
   public synchronized String toString() {
     StringBuilder builder = new StringBuilder();
     builder.append("STAGE DESCRIPTION BEGIN\n");
-    builder.append("requestId="+requestId+"\n");
-    builder.append("stageId="+stageId+"\n");
-    builder.append("clusterName="+clusterName+"\n");
-    builder.append("logDir=" + logDir+"\n");
-    builder.append("requestContext="+requestContext+"\n");
-    builder.append("clusterHostInfo="+clusterHostInfo+"\n");
-    builder.append("commandParamsStage="+commandParamsStage+"\n");
-    builder.append("hostParamsStage="+hostParamsStage+"\n");
-    builder.append("status="+status+"\n");
-    builder.append("displayStatus="+displayStatus+"\n");
+    builder.append("requestId=").append(requestId).append("\n");
+    builder.append("stageId=").append(stageId).append("\n");
+    builder.append("clusterName=").append(clusterName).append("\n");
+    builder.append("logDir=").append(logDir).append("\n");
+    builder.append("requestContext=").append(requestContext).append("\n");
+    builder.append("clusterHostInfo=").append(clusterHostInfo).append("\n");
+    builder.append("commandParamsStage=").append(commandParamsStage).append("\n");
+    builder.append("hostParamsStage=").append(hostParamsStage).append("\n");
+    builder.append("status=").append(status).append("\n");
+    builder.append("displayStatus=").append(displayStatus).append("\n");
     builder.append("Success Factors:\n");
     for (Role r : successFactors.keySet()) {
-      builder.append("  role: "+r+", factor: "+successFactors.get(r)+"\n");
+      builder.append("  role: ").append(r).append(", factor: ").append(successFactors.get(r)).append("\n");
     }
     for (HostRoleCommand hostRoleCommand : getOrderedHostRoleCommands()) {
       builder.append("HOST: ").append(hostRoleCommand.getHostName()).append(" :\n");

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 537b993..a8bfbf0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -5673,7 +5673,7 @@ public class Configuration {
     // now write out specific groupings
     StringBuilder baselineBuffer = new StringBuilder(1024);
     for( ConfigurationGrouping grouping : ConfigurationGrouping.values() ){
-      baselineBuffer.append("#### " + grouping);
+      baselineBuffer.append("#### ").append(grouping);
       baselineBuffer.append(System.lineSeparator());
       baselineBuffer.append("| Property Name | ");
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/ActionRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ActionRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ActionRequest.java
index 6fdac2f..7a4fd36 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ActionRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ActionRequest.java
@@ -121,14 +121,15 @@ public class ActionRequest {
 
   @Override
   public String toString() {
-    return (new StringBuilder()).
-        append("actionName :" + actionName).
-        append(", actionType :" + actionType).
-        append(", inputs :" + inputs).
-        append(", targetService :" + targetService).
-        append(", targetComponent :" + targetComponent).
-        append(", description :" + description).
-        append(", targetType :" + targetType).
-        append(", defaultTimeout :" + defaultTimeout).toString();
+    return new StringBuilder()
+      .append("actionName :").append(actionName)
+      .append(", actionType :").append(actionType)
+      .append(", inputs :").append(inputs)
+      .append(", targetService :").append(targetService)
+      .append(", targetComponent :").append(targetComponent)
+      .append(", description :").append(description)
+      .append(", targetType :").append(targetType)
+      .append(", defaultTimeout :").append(defaultTimeout)
+      .toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
index b3a2def..b89bd45 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
@@ -135,13 +135,12 @@ public class ClusterResponse {
   @Override
   public String toString() {
     StringBuilder sb = new StringBuilder();
-    sb.append("{"
-        + " clusterName=" + clusterName
-        + ", clusterId=" + clusterId
-        + ", provisioningState=" + provisioningState
-        + ", desiredStackVersion=" + desiredStackVersion
-        + ", totalHosts=" + totalHosts
-        + ", hosts=[");
+    sb.append("{ clusterName=").append(clusterName)
+      .append(", clusterId=").append(clusterId)
+      .append(", provisioningState=").append(provisioningState)
+      .append(", desiredStackVersion=").append(desiredStackVersion)
+      .append(", totalHosts=").append(totalHosts)
+      .append(", hosts=[");
 
     if (hostNames != null) {
       int i = 0;
@@ -153,9 +152,7 @@ public class ClusterResponse {
         sb.append(hostName);
       }
     }
-    sb.append("]"
-        + ", clusterHealthReport= " + clusterHealthReport
-        + "}");
+    sb.append("], clusterHealthReport= ").append(clusterHealthReport).append("}");
     return sb.toString();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
index 351974a..a659f96 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
@@ -107,13 +107,13 @@ public class ExecuteActionRequest {
 
   @Override
   public synchronized String toString() {
-    return (new StringBuilder()).
-        append("isCommand :" + isCommand().toString()).
-        append(", action :" + actionName).
-        append(", command :" + commandName).
-        append(", inputs :" + parameters.toString()).
-        append(", resourceFilters: " + resourceFilters).
-        append(", exclusive: " + exclusive).
-        append(", clusterName :" + clusterName).toString();
+    return new StringBuilder()
+      .append("isCommand :").append(isCommand())
+      .append(", action :").append(actionName)
+      .append(", command :").append(commandName)
+      .append(", inputs :").append(parameters)
+      .append(", resourceFilters: ").append(resourceFilters)
+      .append(", exclusive: ").append(exclusive)
+      .append(", clusterName :").append(clusterName).toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
index a8e6315..6c0d4ea 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
@@ -132,11 +132,11 @@ public class ServiceRequest {
 
   public String toString() {
     StringBuilder sb = new StringBuilder();
-    sb.append("clusterName=" + clusterName
-        + ", serviceName=" + serviceName
-        + ", desiredState=" + desiredState
-        + ", credentialStoreEnabled=" + credentialStoreEnabled
-        + ", credentialStoreSupported=" + credentialStoreSupported);
+    sb.append("clusterName=").append(clusterName)
+      .append(", serviceName=").append(serviceName)
+      .append(", desiredState=").append(desiredState)
+      .append(", credentialStoreEnabled=").append(credentialStoreEnabled)
+      .append(", credentialStoreSupported=").append(credentialStoreSupported);
     return sb.toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
index 975476f..df40aa8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
@@ -144,16 +144,15 @@ public class ShortTaskStatus {
 
   public String toString() {
     StringBuilder sb = new StringBuilder();
-    sb.append("ShortTaskStatusDump "
-        + ", stageId=" + stageId
-        + ", taskId=" + taskId
-        + ", hostname=" + hostName
-        + ", role=" + role
-        + ", command=" + command
-        + ", status=" + status
-        + ", outputLog=" + outputLog
-        + ", errorLog=" + errorLog
-    );
+    sb.append("ShortTaskStatusDump ")
+      .append(", stageId=").append(stageId)
+      .append(", taskId=").append(taskId)
+      .append(", hostname=").append(hostName)
+      .append(", role=").append(role)
+      .append(", command=").append(command)
+      .append(", status=").append(status)
+      .append(", outputLog=").append(outputLog)
+      .append(", errorLog=").append(errorLog);
     return sb.toString();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
index 282131a..c25fffe 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
@@ -70,7 +70,7 @@ public class UserRequest {
   @Override
   public String toString() {
     StringBuilder sb = new StringBuilder();
-    sb.append("User, username=" + userName);
+    sb.append("User, username=").append(userName);
     return sb.toString();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/customactions/ActionDefinitionManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/customactions/ActionDefinitionManager.java
b/ambari-server/src/main/java/org/apache/ambari/server/customactions/ActionDefinitionManager.java
index 7a2738b..05af097 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/customactions/ActionDefinitionManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/customactions/ActionDefinitionManager.java
@@ -79,7 +79,7 @@ public class ActionDefinitionManager {
     try {
       return Enum.valueOf(enumm, s);
     } catch (IllegalArgumentException iaex) {
-      reason.append("Invalid value provided for " + enumm.getName());
+      reason.append("Invalid value provided for ").append(enumm.getName());
       return null;
     }
   }
@@ -147,7 +147,7 @@ public class ActionDefinitionManager {
       }
 
       if (actionType == null || actionType == ActionType.SYSTEM_DISABLED) {
-        reason.append("Action type cannot be " + actionType);
+        reason.append("Action type cannot be ").append(actionType);
         return false;
       }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java
index ad18428..2237f86 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java
@@ -75,6 +75,6 @@ public class PostgresHelper extends GenericDbmsHelper {
 
   @Override
   public  StringBuilder writeDropPrimaryKeyStatement(StringBuilder builder, String constraintName,
boolean cascade){
-      return builder.append("DROP CONSTRAINT ").append(constraintName + (cascade ? " CASCADE"
: ""));
+      return builder.append("DROP CONSTRAINT ").append(constraintName).append(cascade ? "
CASCADE" : "");
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraphNode.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraphNode.java
b/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraphNode.java
index d2aac3c..4e305bd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraphNode.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraphNode.java
@@ -72,7 +72,7 @@ public class RoleGraphNode {
   @Override
   public String toString() {
     StringBuilder builder = new StringBuilder();
-    builder.append("("+role+", "+command +", "+inDegree+")");
+    builder.append("(").append(role).append(", ").append(command).append(", ").append(inDegree).append(")");
     return builder.toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/state/HostConfig.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/HostConfig.java b/ambari-server/src/main/java/org/apache/ambari/server/state/HostConfig.java
index f95d843..5395f4c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/HostConfig.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/HostConfig.java
@@ -62,7 +62,7 @@ public class HostConfig {
     StringBuilder sb = new StringBuilder();
     sb.append("{");
     if (defaultVersionTag != null) {
-      sb.append("default = " + defaultVersionTag);
+      sb.append("default = ").append(defaultVersionTag);
     }
     if (!configGroupOverrides.isEmpty()) {
       sb.append(", overrides = [ ");
@@ -71,7 +71,7 @@ public class HostConfig {
         if (i++ != 0) {
           sb.append(", ");
         }
-        sb.append(entry.getKey().toString() + " : " + entry.getValue());
+        sb.append(entry.getKey()).append(" : ").append(entry.getValue());
       }
       sb.append("]");
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
index 515cc63..f6ddc6d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
@@ -439,11 +439,14 @@ public class ServiceComponentImpl implements ServiceComponent {
 
   @Override
   public void debugDump(StringBuilder sb) {
-    sb.append("ServiceComponent={ serviceComponentName=" + getName() + ", recoveryEnabled="
-        + isRecoveryEnabled() + ", clusterName=" + service.getCluster().getClusterName()
-        + ", clusterId=" + service.getCluster().getClusterId() + ", serviceName="
-        + service.getName() + ", desiredStackVersion=" + getDesiredStackVersion()
-        + ", desiredState=" + getDesiredState().toString() + ", hostcomponents=[ ");
+    sb.append("ServiceComponent={ serviceComponentName=").append(getName())
+      .append(", recoveryEnabled=").append(isRecoveryEnabled())
+      .append(", clusterName=").append(service.getCluster().getClusterName())
+      .append(", clusterId=").append(service.getCluster().getClusterId())
+      .append(", serviceName=").append(service.getName())
+      .append(", desiredStackVersion=").append(getDesiredStackVersion())
+      .append(", desiredState=").append(getDesiredState())
+      .append(", hostcomponents=[ ");
     boolean first = true;
     for (ServiceComponentHost sch : hostComponents.values()) {
       if (!first) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
index 9caff6a..a0c0db1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
@@ -423,10 +423,12 @@ public class ServiceImpl implements Service {
 
   @Override
   public void debugDump(StringBuilder sb) {
-    sb.append("Service={ serviceName=" + getName() + ", clusterName=" + cluster.getClusterName()
-        + ", clusterId=" + cluster.getClusterId() + ", desiredStackVersion="
-        + getDesiredStackVersion() + ", desiredState=" + getDesiredState().toString()
-        + ", components=[ ");
+    sb.append("Service={ serviceName=").append(getName())
+      .append(", clusterName=").append(cluster.getClusterName())
+      .append(", clusterId=").append(cluster.getClusterId())
+      .append(", desiredStackVersion=").append(getDesiredStackVersion())
+      .append(", desiredState=").append(getDesiredState())
+      .append(", components=[ ");
     boolean first = true;
     for (ServiceComponent sc : components.values()) {
       if (!first) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
index f994457..9688c60 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
@@ -104,7 +104,7 @@ public class BlueprintValidatorImpl implements BlueprintValidator {
             String propertyValue = propertyEntry.getValue();
             if (propertyValue != null) {
               if (SecretReference.isSecret(propertyValue)) {
-                errorMessage.append("  Config:" + configType + " Property:" + propertyName+"\n");
+                errorMessage.append("  Config:").append(configType).append(" Property:").append(propertyName).append("\n");
                 containsSecretReferences = true;
               }
             }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProviderTest.java
index 5ef7117..62b7d8a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProviderTest.java
@@ -474,9 +474,9 @@ public class GangliaPropertyProviderTest {
       resources.add(resource);
       
       if (hostsList.length() != 0)
-        hostsList.append("," + "host" + i );
+        hostsList.append(",host").append(i);
       else
-        hostsList.append("host" + i); 
+        hostsList.append("host").append(i);
     }
 
     // only ask for one property
@@ -945,7 +945,7 @@ public class GangliaPropertyProviderTest {
       for (String metricRegex: metricsRegexes)
       {
         if (entry.getKey().startsWith(metricRegex)) {
-          metricsBuilder.append(entry.getValue().getPropertyId() + ",");
+          metricsBuilder.append(entry.getValue().getPropertyId()).append(",");
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
index 5d2e605..b4edb41 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
@@ -117,7 +117,7 @@ public class RangerWebAlertConfigActionTest {
 
       try {
         while (scanner.hasNextLine()) {
-          rangerAlertsConfigFile.append(scanner.nextLine() + lineSeparator);
+          rangerAlertsConfigFile.append(scanner.nextLine()).append(lineSeparator);
         }
         Mockito.when(alertDefinitionEntity.getSource()).thenReturn(rangerAlertsConfigFile.toString());
       } finally {


Mime
View raw message