Refine use of substring operations

Closes gh-25445
This commit is contained in:
XenoAmess
2020-07-21 23:09:43 +08:00
committed by Sam Brannen
parent cdc234d7db
commit edfc6c0293
14 changed files with 15 additions and 15 deletions

View File

@@ -269,7 +269,7 @@ public class StompDecoder {
int index = inString.indexOf('\\');
while (index >= 0) {
sb.append(inString.substring(pos, index));
sb.append(inString, pos, index);
if (index + 1 >= inString.length()) {
throw new StompConversionException("Illegal escape sequence at index " + index + ": " + inString);
}

View File

@@ -212,7 +212,7 @@ public class StompEncoder {
private StringBuilder getStringBuilder(@Nullable StringBuilder sb, String inString, int i) {
if (sb == null) {
sb = new StringBuilder(inString.length());
sb.append(inString.substring(0, i));
sb.append(inString, 0, i);
}
return sb;
}