struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1432606 - in /struts/struts2/trunk/xwork-core/src: main/java/com/opensymphony/xwork2/validator/validators/ test/java/com/opensymphony/xwork2/validator/ test/java/com/opensymphony/xwork2/validator/validators/
Date Sun, 13 Jan 2013 13:20:30 GMT
Author: lukaszlenart
Date: Sun Jan 13 13:20:30 2013
New Revision: 1432606

URL: http://svn.apache.org/viewvc?rev=1432606&view=rev
Log:
WW-3904 removes parse param as is not needed anymore

Modified:
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/ValidatorSupport.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/DoubleRangeValidatorTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidatorTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/LongRangeFieldValidatorTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ShortRangeFieldValidatorTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ValidatorSupportTest.java

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/ValidatorSupport.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/ValidatorSupport.java?rev=1432606&r1=1432605&r2=1432606&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/ValidatorSupport.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/ValidatorSupport.java
Sun Jan 13 13:20:30 2013
@@ -44,7 +44,6 @@ public abstract class ValidatorSupport i
     protected String messageKey;
     private ValidatorContext validatorContext;
     private boolean shortCircuit;
-    protected boolean parse;
     private String type;
     private String[] messageParameters;
     protected ValueStack stack;
@@ -64,14 +63,6 @@ public abstract class ValidatorSupport i
         return defaultMessage;
     }
 
-    public void setParse(boolean parse) {
-        this.parse = parse;
-    }
-
-    public boolean getParse() {
-        return parse;
-    }
-
     public String getMessage(Object object) {
         String message;
         boolean pop = false;
@@ -167,19 +158,12 @@ public abstract class ValidatorSupport i
     }
 
     /**
-     * Parse <code>expression</code> passed in against value stack. Only parse
-     * when 'parse' param is set to true, else just returns the expression unparsed.
+     * Parse <code>expression</code> passed in against value stack.
      *
-     * @param expression
+     * @param expression an OGNL expression
+     * @param type type to return
      * @return Object
      */
-    protected Object conditionalParse(String expression) {
-        if (parse) {
-            return TextParseUtil.translateVariables('$', expression, stack);
-        }
-        return expression;
-    }
-
     protected Object parse(String expression, Class type) {
         if (expression == null) {
             return null;
@@ -191,8 +175,8 @@ public abstract class ValidatorSupport i
      * Return the field value named <code>name</code> from <code>object</code>,
      * <code>object</code> should have the appropriate getter/setter.
      *
-     * @param name
-     * @param object
+     * @param name name of the field
+     * @param object to search field name on
      * @return Object as field value
      * @throws ValidationException
      */

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/DoubleRangeValidatorTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/DoubleRangeValidatorTest.java?rev=1432606&r1=1432605&r2=1432606&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/DoubleRangeValidatorTest.java
(original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/DoubleRangeValidatorTest.java
Sun Jan 13 13:20:30 2013
@@ -226,7 +226,6 @@ public class DoubleRangeValidatorTest ex
 
         stack.push(action);
 
-        val.setParse(true);
         val.setMinInclusiveExpression("${minInclusiveValue}");
         val.setMaxInclusiveExpression("${maxInclusiveValue}");
         val.setMinExclusiveExpression("${minExclusiveValue}");

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java?rev=1432606&r1=1432605&r2=1432606&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
(original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java
Sun Jan 13 13:20:30 2013
@@ -94,7 +94,6 @@ public class EmailValidatorTest extends 
         validator.setValidatorContext(new DelegatingValidatorContext(action));
         validator.setFieldName("myEmail");
         validator.setDefaultMessage("invalid email");
-        validator.setParse(true);
         validator.setRegexExpression("${emailExpression}");
 
         validator.validate(action);
@@ -123,7 +122,6 @@ public class EmailValidatorTest extends 
         valueStack.push(action);
         validator.setValueStack(valueStack);
 
-        validator.setParse(true);
         validator.setCaseSensitiveExpression("${emailCaseSensitive}");
 
         valueStack.pop();
@@ -151,7 +149,6 @@ public class EmailValidatorTest extends 
         valueStack.push(action);
         validator.setValueStack(valueStack);
 
-        validator.setParse(true);
         validator.setTrimExpression("${trimEmail}");
 
         valueStack.pop();

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java?rev=1432606&r1=1432605&r2=1432606&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java
(original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java
Sun Jan 13 13:20:30 2013
@@ -75,7 +75,6 @@ public class DateRangeFieldValidatorTest
 
         DateRangeFieldValidator validator = new DateRangeFieldValidator();
         validator.setValueStack(valueStack);
-        validator.setParse(true);
 
         validator.setMaxExpression("${dateMaxValue}");
         validator.setMinExpression("${dateMinValue}");

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidatorTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidatorTest.java?rev=1432606&r1=1432605&r2=1432606&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidatorTest.java
(original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidatorTest.java
Sun Jan 13 13:20:30 2013
@@ -63,7 +63,6 @@ public class IntRangeFieldValidatorTest 
 
         IntRangeFieldValidator validator = new IntRangeFieldValidator();
         validator.setValueStack(valueStack);
-        validator.setParse(true);
 
         validator.setMaxExpression("${intMaxValue}");
         validator.setMinExpression("${intMinValue}");

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/LongRangeFieldValidatorTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/LongRangeFieldValidatorTest.java?rev=1432606&r1=1432605&r2=1432606&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/LongRangeFieldValidatorTest.java
(original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/LongRangeFieldValidatorTest.java
Sun Jan 13 13:20:30 2013
@@ -63,7 +63,6 @@ public class LongRangeFieldValidatorTest
 
         LongRangeFieldValidator validator = new LongRangeFieldValidator();
         validator.setValueStack(valueStack);
-        validator.setParse(true);
 
         validator.setMaxExpression("${longMaxValue}");
         validator.setMinExpression("${longMinValue}");

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ShortRangeFieldValidatorTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ShortRangeFieldValidatorTest.java?rev=1432606&r1=1432605&r2=1432606&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ShortRangeFieldValidatorTest.java
(original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ShortRangeFieldValidatorTest.java
Sun Jan 13 13:20:30 2013
@@ -63,7 +63,6 @@ public class ShortRangeFieldValidatorTes
 
         ShortRangeFieldValidator validator = new ShortRangeFieldValidator();
         validator.setValueStack(valueStack);
-        validator.setParse(true);
 
         validator.setMaxExpression("${shortMaxValue}");
         validator.setMinExpression("${shortMinValue}");

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ValidatorSupportTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ValidatorSupportTest.java?rev=1432606&r1=1432605&r2=1432606&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ValidatorSupportTest.java
(original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/ValidatorSupportTest.java
Sun Jan 13 13:20:30 2013
@@ -41,14 +41,9 @@ public class ValidatorSupportTest extend
 			};
             validator.setValueStack(ActionContext.getContext().getValueStack());
 
-            validator.setParse(true);
-			String result1 = validator.conditionalParse("${#something}").toString();
-
-			validator.setParse(false);
-			String result2 = validator.conditionalParse("${#something}").toString();
+			String result1 = validator.parse("${#something}", String.class).toString();
 
 			assertEquals(result1, "somevalue");
-			assertEquals(result2, "${#something}");
 		}
 		finally {
 			ActionContext.getContext().setValueStack(oldStack);



Mime
View raw message