Polish: String function use should be optimized for single characters
(cherry picked from commit 49fd724)
This commit is contained in:
committed by
Juergen Hoeller
parent
073e78b68d
commit
39ddd0f349
@@ -101,9 +101,9 @@ public class CommonsMultipartFile implements MultipartFile, Serializable {
|
||||
}
|
||||
|
||||
// Check for Unix-style path
|
||||
int unixSep = filename.lastIndexOf("/");
|
||||
int unixSep = filename.lastIndexOf('/');
|
||||
// Check for Windows-style path
|
||||
int winSep = filename.lastIndexOf("\\");
|
||||
int winSep = filename.lastIndexOf('\\');
|
||||
// Cut off at latest possible point
|
||||
int pos = (winSep > unixSep ? winSep : unixSep);
|
||||
if (pos != -1) {
|
||||
|
||||
@@ -713,8 +713,8 @@ public class UriComponentsBuilder implements Cloneable {
|
||||
}
|
||||
|
||||
private void adaptForwardedHost(String hostToUse) {
|
||||
int portSeparatorIdx = hostToUse.lastIndexOf(":");
|
||||
if (portSeparatorIdx > hostToUse.lastIndexOf("]")) {
|
||||
int portSeparatorIdx = hostToUse.lastIndexOf(':');
|
||||
if (portSeparatorIdx > hostToUse.lastIndexOf(']')) {
|
||||
host(hostToUse.substring(0, portSeparatorIdx));
|
||||
port(Integer.parseInt(hostToUse.substring(portSeparatorIdx + 1)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user