diff --git a/.classpath b/.classpath
index d0549ed5d2..62cf322580 100644
--- a/.classpath
+++ b/.classpath
@@ -6,10 +6,6 @@
The class creates and @@ -131,10 +131,10 @@ public class FilterInvocationDefinitionSourceEditor extends PropertyEditorSuppor // Tokenize the line into its name/value tokens // As per SEC-219, use the LAST equals as the delimiter between LHS and RHS - String name = StringUtils.substringBeforeLast(line, "="); - String value = StringUtils.substringAfterLast(line, "="); + String name = StringSplitUtils.substringBeforeLast(line, "="); + String value = StringSplitUtils.substringAfterLast(line, "="); - if (StringUtils.isBlank(name) || StringUtils.isBlank(value)) { + if (!StringUtils.hasText(name) || !StringUtils.hasText(value)) { throw new IllegalArgumentException("Failed to parse a valid name/value pair from " + line); } diff --git a/core/src/main/java/org/acegisecurity/util/StringSplitUtils.java b/core/src/main/java/org/acegisecurity/util/StringSplitUtils.java index bb96d67a05..a0735727ca 100644 --- a/core/src/main/java/org/acegisecurity/util/StringSplitUtils.java +++ b/core/src/main/java/org/acegisecurity/util/StringSplitUtils.java @@ -104,4 +104,31 @@ public class StringSplitUtils { return map; } + + public static String substringBeforeLast(String str, String separator) { + if (str == null || separator == null || str.length() == 0 || + separator.length() == 0) { + return str; + } + int pos = str.lastIndexOf(separator); + if (pos == -1) { + return str; + } + return str.substring(0, pos); + } + + public static String substringAfterLast(String str, String separator) { + if (str == null || str.length() == 0) { + return str; + } + if (separator == null || separator.length() == 0) { + return ""; + } + int pos = str.lastIndexOf(separator); + if (pos == -1 || pos == (str.length() - separator.length())) { + return ""; + } + return str.substring(pos + separator.length()); + } + }