diff --git a/spring-session/src/main/java/org/springframework/session/web/http/CookieHttpSessionStrategy.java b/spring-session/src/main/java/org/springframework/session/web/http/CookieHttpSessionStrategy.java index 57cb8ec1..242e7a9b 100644 --- a/spring-session/src/main/java/org/springframework/session/web/http/CookieHttpSessionStrategy.java +++ b/spring-session/src/main/java/org/springframework/session/web/http/CookieHttpSessionStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -250,18 +250,18 @@ public final class CookieHttpSessionStrategy return sessionIds.values().iterator().next(); } - StringBuffer buffer = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (Map.Entry 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, diff --git a/spring-session/src/test/java/org/springframework/session/web/http/CookieHttpSessionStrategyTests.java b/spring-session/src/test/java/org/springframework/session/web/http/CookieHttpSessionStrategyTests.java index c65e7340..8b3e56ca 100644 --- a/spring-session/src/test/java/org/springframework/session/web/http/CookieHttpSessionStrategyTests.java +++ b/spring-session/src/test/java/org/springframework/session/web/http/CookieHttpSessionStrategyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -710,19 +710,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(); } @SuppressWarnings("deprecation")