summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer-Åke Minborg <minborg@speedment.com>2016-10-28 08:46:30 -0700
committerVaadin Code Review <review@vaadin.com>2016-11-04 13:36:29 +0000
commit888568f27ae538c34a264aeb737bb6dd6b5b9b57 (patch)
treebcbd7e6badd3c10d7bc76cc30b9f95d68701d835
parent0fc0ac038644248b12a2c8d4eed299a7a286d4f8 (diff)
downloadvaadin-framework-888568f27ae538c34a264aeb737bb6dd6b5b9b57.tar.gz
vaadin-framework-888568f27ae538c34a264aeb737bb6dd6b5b9b57.zip
Use chain of .append() methods instead of String concatenation
Change-Id: I80b73b653e97904605dc62484a7448f3bfbf721d
-rw-r--r--server/src/main/java/com/vaadin/server/ComponentSizeValidator.java12
-rw-r--r--server/src/main/java/com/vaadin/server/JsonPaintTarget.java4
-rw-r--r--server/src/main/java/com/vaadin/server/communication/PortletBootstrapHandler.java2
-rw-r--r--server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java2
-rw-r--r--server/src/test/java/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java3
-rw-r--r--server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java2
-rw-r--r--server/src/test/java/com/vaadin/tests/util/GraphVizClassHierarchyCreator.java4
7 files changed, 13 insertions, 16 deletions
diff --git a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
index e68fbb5903..7d4de85cfe 100644
--- a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
+++ b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
@@ -217,7 +217,7 @@ public class ComponentSizeValidator implements Serializable {
Component parent = component.getParent();
String paintableId = component.getConnectorId();
- clientJSON.append("\"id\":\"" + paintableId + "\"");
+ clientJSON.append("\"id\":\"").append(paintableId).append("\"");
if (invalidHeight) {
Stack<ComponentInfo> attributes = null;
@@ -247,7 +247,7 @@ public class ComponentSizeValidator implements Serializable {
attributes = getHeightAttributes(component);
}
printServerError(msg, attributes, false, serverErrorStream);
- clientJSON.append(",\"heightMsg\":\"" + msg + "\"");
+ clientJSON.append(",\"heightMsg\":\"").append(msg).append("\"");
}
if (invalidWidth) {
Stack<ComponentInfo> attributes = null;
@@ -275,7 +275,7 @@ public class ComponentSizeValidator implements Serializable {
msg = "A component with relative width needs a parent with defined width.";
attributes = getWidthAttributes(component);
}
- clientJSON.append(",\"widthMsg\":\"" + msg + "\"");
+ clientJSON.append(",\"widthMsg\":\"").append(msg).append("\"");
printServerError(msg, attributes, true, serverErrorStream);
}
if (subErrors.size() > 0) {
@@ -402,8 +402,7 @@ public class ComponentSizeValidator implements Serializable {
}
if (createLoc != null) {
- err.append(", created at (" + createLoc.file + ":"
- + createLoc.lineNumber + ")");
+ err.append(", created at (").append(createLoc.file).append(":").append(createLoc.lineNumber).append(")");
}
@@ -411,8 +410,7 @@ public class ComponentSizeValidator implements Serializable {
err.append(" (");
err.append(attribute);
if (sizeLoc != null) {
- err.append(", set at (" + sizeLoc.file + ":"
- + sizeLoc.lineNumber + ")");
+ err.append(", set at (").append(sizeLoc.file).append(":").append(sizeLoc.lineNumber).append(")");
}
err.append(")");
diff --git a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java
index 4463fd1ab5..9792673062 100644
--- a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java
+++ b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java
@@ -443,7 +443,7 @@ public class JsonPaintTarget implements PaintTarget {
"Parameters must be non-null strings");
}
final StringBuilder buf = new StringBuilder();
- buf.append("\"" + name + "\":[");
+ buf.append("\"").append(name).append("\":[");
for (int i = 0; i < values.length; i++) {
if (i > 0) {
buf.append(",");
@@ -743,7 +743,7 @@ public class JsonPaintTarget implements PaintTarget {
private boolean tagClosed = false;
public JsonTag(String tagName) {
- data.append("[\"" + tagName + "\"");
+ data.append("[\"").append(tagName).append("\"");
}
private void closeTag() {
diff --git a/server/src/main/java/com/vaadin/server/communication/PortletBootstrapHandler.java b/server/src/main/java/com/vaadin/server/communication/PortletBootstrapHandler.java
index 2b40b6caca..a75e6a810b 100644
--- a/server/src/main/java/com/vaadin/server/communication/PortletBootstrapHandler.java
+++ b/server/src/main/java/com/vaadin/server/communication/PortletBootstrapHandler.java
@@ -78,7 +78,7 @@ public class PortletBootstrapHandler extends BootstrapHandler {
&& !portalTheme.equals(context.getThemeName())) {
String portalThemeUri = getThemeUri(context, portalTheme);
// XSS safe - originates from portal properties
- builder.append("vaadin.loadTheme('" + portalThemeUri + "');");
+ builder.append("vaadin.loadTheme('").append(portalThemeUri).append("');");
}
super.appendMainScriptTagContents(context, builder);
diff --git a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java
index f0bcc8887a..e2e8148871 100644
--- a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java
+++ b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java
@@ -268,7 +268,7 @@ public abstract class DeclarativeTestBaseBase<T extends Component> {
}
Collections.sort(names);
- sb.append("<" + producedElem.tagName() + "");
+ sb.append("<").append(producedElem.tagName()).append("");
for (String attrName : names) {
sb.append(" ").append(attrName);
if (!booleanAttributes.contains(attrName)) {
diff --git a/server/src/test/java/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java b/server/src/test/java/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java
index 75ab52370d..b870e0ab4f 100644
--- a/server/src/test/java/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java
@@ -160,8 +160,7 @@ public class AttachDetachListenersTest {
@Override
public void appendTo(StringBuffer buffer) {
buffer.append("EventEquals(");
- buffer.append("expected " + expected.getClass().getSimpleName()
- + " with connector " + expected.getConnector());
+ buffer.append("expected ").append(expected.getClass().getSimpleName()).append(" with connector ").append(expected.getConnector());
buffer.append(")");
}
diff --git a/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java b/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java
index 1a1d15edcf..be3f402e16 100644
--- a/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java
@@ -256,7 +256,7 @@ public class NavigatorTest {
EasyMock.reportMatcher(new IArgumentMatcher() {
@Override
public void appendTo(StringBuffer buffer) {
- buffer.append("paramsIs(\"" + expected + "\")");
+ buffer.append("paramsIs(\"").append(expected).append("\")");
}
@Override
diff --git a/server/src/test/java/com/vaadin/tests/util/GraphVizClassHierarchyCreator.java b/server/src/test/java/com/vaadin/tests/util/GraphVizClassHierarchyCreator.java
index c322eb7ed8..ebde4b191a 100644
--- a/server/src/test/java/com/vaadin/tests/util/GraphVizClassHierarchyCreator.java
+++ b/server/src/test/java/com/vaadin/tests/util/GraphVizClassHierarchyCreator.java
@@ -50,14 +50,14 @@ public class GraphVizClassHierarchyCreator {
header.append(" node [shape = ellipse, style=\"dotted\"] ");
for (Class c : classesAndParents) {
if (!c.isInterface() && Modifier.isAbstract(c.getModifiers())) {
- header.append(c.getSimpleName() + " ");
+ header.append(c.getSimpleName()).append(" ");
}
}
if (includeInterfaces) {
System.out.print(" node [shape = ellipse, style=\"solid\"] ");
for (Class c : classesAndParents) {
if (c.isInterface()) {
- header.append(c.getSimpleName() + " ");
+ header.append(c.getSimpleName()).append(" ");
}
}
header.append(";\n");