From 6cf023fad94d31a7a77f084129aaf26915f841b9 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 2 Oct 2023 16:16:03 +0300 Subject: [PATCH] Replace StringBuffer with StringBuilder in RR code --- .../reactive/common/headers/CacheControlDelegate.java | 4 ++-- .../reactive/common/headers/CookieHeaderDelegate.java | 2 +- .../jboss/resteasy/reactive/common/headers/LinkDelegate.java | 4 ++-- .../jboss/resteasy/reactive/common/headers/ServerCookie.java | 2 +- .../jboss/resteasy/reactive/common/util/ParameterParser.java | 2 +- .../jboss/resteasy/reactive/common/util/PathSegmentImpl.java | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/CacheControlDelegate.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/CacheControlDelegate.java index 3cf3f681f1c06..de493256abe24 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/CacheControlDelegate.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/CacheControlDelegate.java @@ -72,7 +72,7 @@ public CacheControl fromString(String value) throws IllegalArgumentException { return result; } - private static StringBuffer addDirective(String directive, StringBuffer buffer) { + private static StringBuilder addDirective(String directive, StringBuilder buffer) { if (buffer.length() > 0) buffer.append(", "); buffer.append(directive); @@ -82,7 +82,7 @@ private static StringBuffer addDirective(String directive, StringBuffer buffer) public String toString(CacheControl value) { if (value == null) throw new IllegalArgumentException("param was null"); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); if (value.isNoCache()) { List fields = value.getNoCacheFields(); if (fields.size() < 1) { diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/CookieHeaderDelegate.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/CookieHeaderDelegate.java index 443baeec0b5da..4fd50b27b541d 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/CookieHeaderDelegate.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/CookieHeaderDelegate.java @@ -16,7 +16,7 @@ public Cookie fromString(String value) throws IllegalArgumentException { } public String toString(Cookie value) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); ServerCookie.appendCookieValue(buf, 0, value.getName(), value.getValue(), value.getPath(), value.getDomain(), null, -1, false); return buf.toString(); diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/LinkDelegate.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/LinkDelegate.java index 5179d876e1c5a..30fd950ca662d 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/LinkDelegate.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/LinkDelegate.java @@ -106,7 +106,7 @@ public void parseAttribute(MultivaluedMap attributes) { val = value.substring(curr, end); curr = end + 1; } else { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); while (curr < value.length()) { char c = value.charAt(curr); if (c == ',' || c == ';') @@ -136,7 +136,7 @@ public Link fromString(String value) throws IllegalArgumentException { public String toString(Link value) throws IllegalArgumentException { if (value == null) throw new IllegalArgumentException("value was null"); - StringBuffer buf = new StringBuffer("<"); + StringBuilder buf = new StringBuilder("<"); buf.append(value.getUri().toString()).append(">"); for (Map.Entry entry : value.getParams().entrySet()) { diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/ServerCookie.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/ServerCookie.java index 34805d8cf5606..d3f56484808a2 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/ServerCookie.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/ServerCookie.java @@ -147,7 +147,7 @@ public static void formatOldCookie(Date d, StringBuffer sb, private static final String ancientDate = formatOldCookie(new Date(10000)); // TODO RFC2965 fields also need to be passed - public static void appendCookieValue(StringBuffer headerBuf, + public static void appendCookieValue(StringBuilder headerBuf, int version, String name, String value, diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/ParameterParser.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/ParameterParser.java index 8812bf5d23577..fbe05705f6d3d 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/ParameterParser.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/ParameterParser.java @@ -304,7 +304,7 @@ public String setAttribute( int start = offset; - StringBuffer newChars = new StringBuffer(); + StringBuilder newChars = new StringBuilder(); while (hasChar()) { paramName = parseToken(new char[] { '=', separator }); diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/PathSegmentImpl.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/PathSegmentImpl.java index b8ac4d7e170b5..81da9e2cee1d3 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/PathSegmentImpl.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/PathSegmentImpl.java @@ -77,7 +77,7 @@ public MultivaluedMap getMatrixParameters() { } public String toString() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); if (path != null) buf.append(path); if (matrixParameters != null) {