Fix String concatenation within a StringBuilder append chain

This commit replaces String concatenation within a StringBuilder append chain by using explicit append calls.
This commit is contained in:
Koen De Groote 2017-05-18 08:51:30 +02:00 committed by Yannick Welsch
parent 26e2e933f5
commit d744d77f61
3 changed files with 12 additions and 12 deletions

View File

@ -193,7 +193,7 @@ public class RoutingNode implements Iterable<ShardRouting> {
public String prettyPrint() {
StringBuilder sb = new StringBuilder();
sb.append("-----node_id[").append(nodeId).append("][" + (node == null ? "X" : "V") + "]\n");
sb.append("-----node_id[").append(nodeId).append("][").append(node == null ? "X" : "V").append("]\n");
for (ShardRouting entry : shards.values()) {
sb.append("--------").append(entry.shortSummary()).append('\n');
}

View File

@ -121,15 +121,15 @@ public final class IfConfig {
sb.append("inet ");
sb.append(NetworkAddress.format(address));
int netmask = 0xFFFFFFFF << (32 - interfaceAddress.getNetworkPrefixLength());
sb.append(" netmask:" + NetworkAddress.format(InetAddress.getByAddress(new byte[] {
(byte)(netmask >>> 24),
(byte)(netmask >>> 16 & 0xFF),
(byte)(netmask >>> 8 & 0xFF),
(byte)(netmask & 0xFF)
sb.append(" netmask:").append(NetworkAddress.format(InetAddress.getByAddress(new byte[]{
(byte) (netmask >>> 24),
(byte) (netmask >>> 16 & 0xFF),
(byte) (netmask >>> 8 & 0xFF),
(byte) (netmask & 0xFF)
})));
InetAddress broadcast = interfaceAddress.getBroadcast();
if (broadcast != null) {
sb.append(" broadcast:" + NetworkAddress.format(broadcast));
sb.append(" broadcast:").append(NetworkAddress.format(broadcast));
}
}
if (address.isLoopbackAddress()) {
@ -160,8 +160,8 @@ public final class IfConfig {
if (nic.isVirtual()) {
flags.append("VIRTUAL ");
}
flags.append("mtu:" + nic.getMTU());
flags.append(" index:" + nic.getIndex());
flags.append("mtu:").append(nic.getMTU());
flags.append(" index:").append(nic.getIndex());
return flags.toString();
}
}

View File

@ -61,7 +61,7 @@ public abstract class ModuleTestCase extends ESTestCase {
}
StringBuilder s = new StringBuilder();
for (Element element : elements) {
s.append(element + "\n");
s.append(element).append("\n");
}
fail("Did not find any binding to " + to.getName() + ". Found these bindings:\n" + s);
}
@ -93,7 +93,7 @@ public abstract class ModuleTestCase extends ESTestCase {
List<Element> elements = Elements.getElements(module);
StringBuilder s = new StringBuilder();
for (Element element : elements) {
s.append(element + "\n");
s.append(element).append("\n");
}
fail("Expected exception from configuring module. Found these bindings:\n" + s);
} catch (IllegalArgumentException e) {
@ -220,7 +220,7 @@ public abstract class ModuleTestCase extends ESTestCase {
}
StringBuilder s = new StringBuilder();
for (Element element : elements) {
s.append(element + "\n");
s.append(element).append("\n");
}
fail("Did not find any instance binding to " + to.getName() + ". Found these bindings:\n" + s);
}