use StringBuilder correctly

This commit is contained in:
Dave Brosius 2016-09-04 12:19:16 -04:00
parent 7d593b760c
commit 3c95d4731c
6 changed files with 18 additions and 18 deletions

View File

@ -952,7 +952,7 @@ public class TableMetrics
String groupName = TableMetrics.class.getPackage().getName();
StringBuilder mbeanName = new StringBuilder();
mbeanName.append(groupName).append(":");
mbeanName.append("type=" + type);
mbeanName.append("type=").append(type);
mbeanName.append(",name=").append(metricName);
return new CassandraMetricsRegistry.MetricName(groupName, type, metricName, "all", mbeanName.toString());
}

View File

@ -72,7 +72,7 @@ public class Ring extends NodeToolCmd
String formatPlaceholder = "%%-%ds %%-12s%%-7s%%-8s%%-16s%%-20s%%-44s%%n";
String format = format(formatPlaceholder, maxAddressLength);
StringBuffer errors = new StringBuffer();
StringBuilder errors = new StringBuilder();
boolean showEffectiveOwnership = true;
// Calculate per-token ownership of the ring
Map<InetAddress, Float> ownerships;
@ -83,7 +83,7 @@ public class Ring extends NodeToolCmd
catch (IllegalStateException ex)
{
ownerships = probe.getOwnership();
errors.append("Note: " + ex.getMessage() + "%n");
errors.append("Note: ").append(ex.getMessage()).append("%n");
showEffectiveOwnership = false;
}
catch (IllegalArgumentException ex)

View File

@ -65,7 +65,7 @@ public class Status extends NodeToolCmd
hostIDMap = probe.getHostIdMap();
epSnitchInfo = probe.getEndpointSnitchInfoProxy();
StringBuffer errors = new StringBuffer();
StringBuilder errors = new StringBuilder();
Map<InetAddress, Float> ownerships = null;
boolean hasEffectiveOwns = false;
@ -77,7 +77,7 @@ public class Status extends NodeToolCmd
catch (IllegalStateException e)
{
ownerships = probe.getOwnership();
errors.append("Note: " + e.getMessage() + "%n");
errors.append("Note: ").append(e.getMessage()).append("%n");
}
catch (IllegalArgumentException ex)
{

View File

@ -464,7 +464,7 @@ public class StressProfile implements Serializable
List<ColumnDefinition> allColumns = com.google.common.collect.Lists.newArrayList(cfMetaData.allColumnsInSelectOrder());
StringBuilder sb = new StringBuilder();
sb.append("INSERT INTO ").append(quoteIdentifier(keyspaceName) + "." + quoteIdentifier(tableName)).append(" (");
sb.append("INSERT INTO ").append(quoteIdentifier(keyspaceName)).append(".").append(quoteIdentifier(tableName)).append(" (");
StringBuilder value = new StringBuilder();
for (ColumnDefinition c : allColumns)
{
@ -664,7 +664,7 @@ public class StressProfile implements Serializable
return first;
if (val != null && val.trim().length() > 0)
return builder.apply(val);
return builder.apply(defValue);
}

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.stress.settings;
/*
*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -8,16 +8,16 @@ package org.apache.cassandra.stress.settings;
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*
*/
@ -63,7 +63,7 @@ public final class OptionAnyProbabilities extends OptionMulti
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, Double> entry : options.entrySet())
{
sb.append(entry.getKey() + "=" + entry.getValue() + ",");
sb.append(entry.getKey()).append("=").append(entry.getValue()).append(",");
}
return sb.toString();
}

View File

@ -1,6 +1,6 @@
package org.apache.cassandra.stress.settings;
/*
*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@ -8,16 +8,16 @@ package org.apache.cassandra.stress.settings;
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*
*/
@ -112,7 +112,7 @@ abstract class OptionMulti extends Option
public String getOptionAsString()
{
StringBuilder sb = new StringBuilder();
sb.append(name + ": ");
sb.append(name).append(": ");
sb.append(delegate.getOptionAsString());
sb.append(";");
if (collectAsMap != null)
@ -188,7 +188,7 @@ abstract class OptionMulti extends Option
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : options.entrySet())
{
sb.append(entry.getKey() + "=" + entry.getValue() + ",");
sb.append(entry.getKey()).append("=").append(entry.getValue()).append(",");
}
return sb.toString();
}