From 8966de114b21dece25703f90bbee4db3136f6c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kv=C3=ADdera?= Date: Sun, 9 Feb 2020 12:33:53 +0100 Subject: [PATCH] #4281 Fixed usage of StringBuilder --- .../ha/session/management/BaseHASession.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/session/management/BaseHASession.java b/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/session/management/BaseHASession.java index 316375f9daf..ccc58d38bef 100644 --- a/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/session/management/BaseHASession.java +++ b/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/session/management/BaseHASession.java @@ -225,7 +225,7 @@ private void writeObject(ObjectOutputStream stream) throws IOException { /** * Return a string representation of this object. */ - public String superToString() { + private CharSequence superToString() { StringBuilder sb = new StringBuilder(1000); sb.append("BaseHASession["); @@ -233,7 +233,7 @@ public String superToString() { sb.append("]"); sb.append("\n"); - sb.append("isValid:" + getIsValid()); + sb.append("isValid:").append(getIsValid()); if (getIsValid()) { Enumeration attrNamesEnum = getAttributeNamesInternal(); @@ -241,23 +241,22 @@ public String superToString() { String nextAttrName = attrNamesEnum.nextElement(); Object nextAttrValue = getAttributeInternal(nextAttrName); sb.append("\n"); - sb.append("attrName = " + nextAttrName); - sb.append(" : attrValue = " + nextAttrValue); + sb.append("attrName = ").append(nextAttrName); + sb.append(" : attrValue = ").append(nextAttrValue); } } - return sb.toString(); + return sb; // END S1AS } public String toString() { - StringBuilder sb = new StringBuilder(200); - //sb.append(super.toString()); - sb.append(this.superToString()); - sb.append(" ssoid: " + this.getSsoId()); - sb.append(" userName: " + this.getUserName()); - sb.append(" version: " + this.getVersion()); - sb.append(" persistent: " + this.isPersistent()); + StringBuilder sb = new StringBuilder(1200); + sb.append(superToString()); + sb.append(" ssoid: ").append(getSsoId()); + sb.append(" userName: ").append(getUserName()); + sb.append(" version: ").append(getVersion()); + sb.append(" persistent: ").append(isPersistent()); return sb.toString(); }