Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
* @author Sam Brannen
* @author Brian Clozel
* @author Sebastien Deleuze
* @author SungJun Park
* @since 16 April 2001
*/
public abstract class StringUtils {
Expand All @@ -72,6 +73,8 @@ public abstract class StringUtils {

private static final String WINDOWS_FOLDER_SEPARATOR = "\\";

private static final char WINDOWS_FOLDER_SEPARATOR_CHAR = '\\';

private static final String DOUBLE_BACKSLASHES = "\\\\";

private static final String TOP_PATH = "..";
Expand Down Expand Up @@ -712,7 +715,7 @@ public static String cleanPath(String path) {

String normalizedPath;
// Optimize when there is no backslash
if (path.indexOf('\\') != -1) {
if (path.indexOf(WINDOWS_FOLDER_SEPARATOR_CHAR) != -1) {
normalizedPath = replace(path, DOUBLE_BACKSLASHES, FOLDER_SEPARATOR);
normalizedPath = replace(normalizedPath, WINDOWS_FOLDER_SEPARATOR, FOLDER_SEPARATOR);
}
Expand All @@ -722,7 +725,7 @@ public static String cleanPath(String path) {
String pathToUse = normalizedPath;

// Shortcut if there is no work to do
if (pathToUse.indexOf('.') == -1) {
if (pathToUse.indexOf(EXTENSION_SEPARATOR) == -1) {
return pathToUse;
}

Expand Down