From 888568f27ae538c34a264aeb737bb6dd6b5b9b57 Mon Sep 17 00:00:00 2001 From: Per-Åke Minborg Date: Fri, 28 Oct 2016 08:46:30 -0700 Subject: Use chain of .append() methods instead of String concatenation Change-Id: I80b73b653e97904605dc62484a7448f3bfbf721d --- .../main/java/com/vaadin/server/ComponentSizeValidator.java | 12 +++++------- server/src/main/java/com/vaadin/server/JsonPaintTarget.java | 4 ++-- .../vaadin/server/communication/PortletBootstrapHandler.java | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'server/src/main/java') 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 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 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); -- cgit v1.2.3