Polishes how error messages are displayed

Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/266f83f1
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/266f83f1
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/266f83f1

Branch: refs/heads/master
Commit: 266f83f15ca8338047a0bdb34a38ebfc8c894a6a
Parents: eeab265
Author: Lukasz Lenart <lukaszlen...@apache.org>
Authored: Wed Nov 12 09:59:31 2014 +0100
Committer: Lukasz Lenart <lukaszlen...@apache.org>
Committed: Wed Nov 12 09:59:31 2014 +0100

----------------------------------------------------------------------
 .../xwork2/interceptor/ParametersInterceptor.java       |  4 ++--
 .../xwork2/security/AcceptedPatternsChecker.java        | 12 ++++++------
 .../xwork2/security/DefaultAcceptedPatternsChecker.java |  4 ++--
 .../xwork2/security/DefaultExcludedPatternsChecker.java |  2 +-
 .../xwork2/security/ExcludedPatternsChecker.java        | 12 ++++++------
 5 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/266f83f1/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
----------------------------------------------------------------------
diff --git 
a/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
 
b/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
index 4cd5a24..d26d094 100644
--- 
a/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
+++ 
b/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
@@ -430,14 +430,14 @@ public class ParametersInterceptor extends 
MethodFilterInterceptor {
         if (result.isAccepted()) {
             return true;
         }
-        notifyDeveloper("Parameter [#0] didn't match accepted pattern [#1]!", 
paramName, String.valueOf(result.getAcceptedPattern()));
+        notifyDeveloper("Parameter [#0] didn't match accepted pattern [#1]!", 
paramName, result.getAcceptedPattern());
         return false;
     }
 
     protected boolean isExcluded(String paramName) {
         ExcludedPatternsChecker.IsExcluded result = 
excludedPatterns.isExcluded(paramName);
         if (result.isExcluded()) {
-            notifyDeveloper("Parameter [#0] matches excluded pattern [#1]!", 
paramName, String.valueOf(result.getExcludedPattern()));
+            notifyDeveloper("Parameter [#0] matches excluded pattern [#1]!", 
paramName, result.getExcludedPattern());
             return true;
         }
         return false;

http://git-wip-us.apache.org/repos/asf/struts/blob/266f83f1/xwork-core/src/main/java/com/opensymphony/xwork2/security/AcceptedPatternsChecker.java
----------------------------------------------------------------------
diff --git 
a/xwork-core/src/main/java/com/opensymphony/xwork2/security/AcceptedPatternsChecker.java
 
b/xwork-core/src/main/java/com/opensymphony/xwork2/security/AcceptedPatternsChecker.java
index 3e48553..64592fa 100644
--- 
a/xwork-core/src/main/java/com/opensymphony/xwork2/security/AcceptedPatternsChecker.java
+++ 
b/xwork-core/src/main/java/com/opensymphony/xwork2/security/AcceptedPatternsChecker.java
@@ -47,17 +47,17 @@ public interface AcceptedPatternsChecker {
     public final static class IsAccepted {
 
         private final boolean accepted;
-        private final Pattern acceptedPattern;
+        private final String acceptedPattern;
 
-        public static IsAccepted yes(Pattern acceptedPattern) {
+        public static IsAccepted yes(String acceptedPattern) {
             return new IsAccepted(true, acceptedPattern);
         }
 
-        public static IsAccepted no() {
-            return new IsAccepted(false, null);
+        public static IsAccepted no(String acceptedPatterns) {
+            return new IsAccepted(false, acceptedPatterns);
         }
 
-        private IsAccepted(boolean accepted, Pattern acceptedPattern) {
+        private IsAccepted(boolean accepted, String acceptedPattern) {
             this.accepted = accepted;
             this.acceptedPattern = acceptedPattern;
         }
@@ -66,7 +66,7 @@ public interface AcceptedPatternsChecker {
             return accepted;
         }
 
-        public Pattern getAcceptedPattern() {
+        public String getAcceptedPattern() {
             return acceptedPattern;
         }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/266f83f1/xwork-core/src/main/java/com/opensymphony/xwork2/security/DefaultAcceptedPatternsChecker.java
----------------------------------------------------------------------
diff --git 
a/xwork-core/src/main/java/com/opensymphony/xwork2/security/DefaultAcceptedPatternsChecker.java
 
b/xwork-core/src/main/java/com/opensymphony/xwork2/security/DefaultAcceptedPatternsChecker.java
index 9071f67..4992281 100644
--- 
a/xwork-core/src/main/java/com/opensymphony/xwork2/security/DefaultAcceptedPatternsChecker.java
+++ 
b/xwork-core/src/main/java/com/opensymphony/xwork2/security/DefaultAcceptedPatternsChecker.java
@@ -71,10 +71,10 @@ public class DefaultAcceptedPatternsChecker implements 
AcceptedPatternsChecker {
                 if (LOG.isTraceEnabled()) {
                     LOG.trace("[#0] matches accepted pattern [#1]", value, 
acceptedPattern);
                 }
-                return IsAccepted.yes(acceptedPattern);
+                return IsAccepted.yes(acceptedPattern.toString());
             }
         }
-        return IsAccepted.no();
+        return IsAccepted.no(acceptedPatterns.toString());
     }
 
     public Set<Pattern> getAcceptedPatterns() {

http://git-wip-us.apache.org/repos/asf/struts/blob/266f83f1/xwork-core/src/main/java/com/opensymphony/xwork2/security/DefaultExcludedPatternsChecker.java
----------------------------------------------------------------------
diff --git 
a/xwork-core/src/main/java/com/opensymphony/xwork2/security/DefaultExcludedPatternsChecker.java
 
b/xwork-core/src/main/java/com/opensymphony/xwork2/security/DefaultExcludedPatternsChecker.java
index 3a7a0c1..8878dd2 100644
--- 
a/xwork-core/src/main/java/com/opensymphony/xwork2/security/DefaultExcludedPatternsChecker.java
+++ 
b/xwork-core/src/main/java/com/opensymphony/xwork2/security/DefaultExcludedPatternsChecker.java
@@ -83,7 +83,7 @@ public class DefaultExcludedPatternsChecker implements 
ExcludedPatternsChecker {
                 return IsExcluded.yes(excludedPattern);
             }
         }
-        return IsExcluded.no();
+        return IsExcluded.no(excludedPatterns);
     }
 
     public Set<Pattern> getExcludedPatterns() {

http://git-wip-us.apache.org/repos/asf/struts/blob/266f83f1/xwork-core/src/main/java/com/opensymphony/xwork2/security/ExcludedPatternsChecker.java
----------------------------------------------------------------------
diff --git 
a/xwork-core/src/main/java/com/opensymphony/xwork2/security/ExcludedPatternsChecker.java
 
b/xwork-core/src/main/java/com/opensymphony/xwork2/security/ExcludedPatternsChecker.java
index 81b9895..5a3bc07 100644
--- 
a/xwork-core/src/main/java/com/opensymphony/xwork2/security/ExcludedPatternsChecker.java
+++ 
b/xwork-core/src/main/java/com/opensymphony/xwork2/security/ExcludedPatternsChecker.java
@@ -47,17 +47,17 @@ public interface ExcludedPatternsChecker {
     public final static class IsExcluded {
 
         private final boolean excluded;
-        private final Pattern excludedPattern;
+        private final String excludedPattern;
 
         public static IsExcluded yes(Pattern excludedPattern) {
-            return new IsExcluded(true, excludedPattern);
+            return new IsExcluded(true, excludedPattern.pattern());
         }
 
-        public static IsExcluded no() {
-            return new IsExcluded(false, null);
+        public static IsExcluded no(Set<Pattern> excludedPatterns) {
+            return new IsExcluded(false, excludedPatterns.toString());
         }
 
-        private IsExcluded(boolean excluded, Pattern excludedPattern) {
+        private IsExcluded(boolean excluded, String excludedPattern) {
             this.excluded = excluded;
             this.excludedPattern = excludedPattern;
         }
@@ -66,7 +66,7 @@ public interface ExcludedPatternsChecker {
             return excluded;
         }
 
-        public Pattern getExcludedPattern() {
+        public String getExcludedPattern() {
             return excludedPattern;
         }
 

Reply via email to