diff --git a/.classpath b/.classpath index d0549ed5d2..62cf322580 100644 --- a/.classpath +++ b/.classpath @@ -6,10 +6,6 @@ - - - - @@ -52,7 +48,6 @@ - diff --git a/core/src/main/java/org/acegisecurity/intercept/web/FilterInvocationDefinitionSourceEditor.java b/core/src/main/java/org/acegisecurity/intercept/web/FilterInvocationDefinitionSourceEditor.java index 133e586d67..9f0c691058 100644 --- a/core/src/main/java/org/acegisecurity/intercept/web/FilterInvocationDefinitionSourceEditor.java +++ b/core/src/main/java/org/acegisecurity/intercept/web/FilterInvocationDefinitionSourceEditor.java @@ -15,18 +15,18 @@ package org.acegisecurity.intercept.web; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import java.beans.PropertyEditorSupport; - import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.List; +import org.acegisecurity.util.StringSplitUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.util.StringUtils; + /** * Property editor to assist with the setup of a {@link FilterInvocationDefinitionSource}.

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()); + } + }