Replace StringBuffer usages with StringBuilder

Fixes gh-718
This commit is contained in:
Vedran Pavic
2017-05-30 22:40:28 +02:00
parent 79f187ddd6
commit e3c6fb67f2
2 changed files with 13 additions and 13 deletions

View File

@@ -251,18 +251,18 @@ public final class CookieHttpSessionStrategy
return sessionIds.values().iterator().next();
}
StringBuffer buffer = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : sessionIds.entrySet()) {
String alias = entry.getKey();
String id = entry.getValue();
buffer.append(alias);
buffer.append(this.serializationDelimiter);
buffer.append(id);
buffer.append(this.serializationDelimiter);
sb.append(alias);
sb.append(this.serializationDelimiter);
sb.append(id);
sb.append(this.serializationDelimiter);
}
buffer.deleteCharAt(buffer.length() - 1);
return buffer.toString();
sb.deleteCharAt(sb.length() - 1);
return sb.toString();
}
public void onInvalidateSession(HttpServletRequest request,

View File

@@ -705,19 +705,19 @@ public class CookieHttpSessionStrategyTests {
}
private String createSessionCookieValue(long size) {
StringBuffer buffer = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (long i = 0; i < size; i++) {
String hex = Long.toHexString(i);
buffer.append(hex);
buffer.append(" ");
buffer.append(i);
sb.append(hex);
sb.append(" ");
sb.append(i);
if (i < size - 1) {
buffer.append(" ");
sb.append(" ");
}
}
return buffer.toString();
return sb.toString();
}
public void setCookieName(String cookieName) {