Refine use of substring operations

Closes gh-25445
This commit is contained in:
Juergen Hoeller
2020-08-07 14:50:44 +02:00
parent b254777744
commit ce4001dd40
15 changed files with 39 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -263,7 +263,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

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -224,7 +224,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;
}