Refine use of substring operations
Closes gh-25445
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user