You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ma...@apache.org on 2005/05/07 18:11:42 UTC

svn commit: r169091 [5/5] - in /struts/core/trunk/src/share/org/apache/struts: ./ action/ actions/ chain/ chain/commands/ chain/commands/generic/ chain/commands/servlet/ chain/commands/util/ chain/contexts/ config/ config/impl/ mock/ plugins/ upload/ util/ validator/ validator/validwhen/

Modified: struts/core/trunk/src/share/org/apache/struts/validator/LazyValidatorForm.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/validator/LazyValidatorForm.java?rev=169091&r1=169090&r2=169091&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/validator/LazyValidatorForm.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/validator/LazyValidatorForm.java Sat May  7 09:11:38 2005
@@ -1,5 +1,5 @@
 /*
- * $Id$ 
+ * $Id$
  *
  * Copyright 2004 The Apache Software Foundation.
  *
@@ -27,7 +27,7 @@
 /**
  * <p>Struts <i>Lazy</i> <code>ActionForm</code> which <i>wraps</i> a <code>LazyDynaBean</code>.</p>
  *
- * <p>There isn't really that much to this implementation as most of the <i>lazy</i> behaviour is in 
+ * <p>There isn't really that much to this implementation as most of the <i>lazy</i> behaviour is in
  *    <code>LazyDynaBean</code> and <i>wrapping</i> the <code>LazyDynaBean<code> is handled in the parent
  *    <code>BeanValidatorForm</code>. The only thing it really does is populate <i>indexed</i> properties
  *    which are a <code>List<code> type with a <code>LazyDynaBean<code> in the <code>get(name, index)</code>
@@ -45,8 +45,8 @@
  *         for <i>mapped</i> properties, if it doesn't exist.</li>
  * </ul>
  *
- * <p>Using this <i>lazy</i> <code>ActionForm</code> means that you don't have to define the ActionForm's 
- *    properties in the <code>struts-config.xml</code>. However, a word of warning, everything in the 
+ * <p>Using this <i>lazy</i> <code>ActionForm</code> means that you don't have to define the ActionForm's
+ *    properties in the <code>struts-config.xml</code>. However, a word of warning, everything in the
  *    Request gets populated into this <code>ActionForm</code> circumventing the normal <i>firewall</i>
  *    function of Struts forms. Therefore you should only <i>take out</i> of this form properties you expect
  *    to be there rather than blindly populating all the properties into the business tier.</p>
@@ -55,7 +55,7 @@
  *    useful to sometimes do so for <i>mapped</i> or <i>indexed</i> properties. For example, if you want to use
  *    a different <code>Map<code> implementation from the default <code>HashMap</code> or an array for indexed
  *    properties, rather than the default <code>List</code> type:</p>
- * 
+ *
  * <pre><code>
  *   &lt;form-bean name="myForm" type="org.apache.struts.validator.LazyValidatorForm"&gt;
  *     &lt;form-property name="myMap" type="java.util.TreeMap" /&gt;
@@ -86,7 +86,7 @@
  * <p>Rather than using this class, another alternative is to either use a <code>LazyDynaBean</code> or
  *    custom version of <code>LazyDynaBean</code> directly. Struts now automatically <i>wraps</i> objects
  *    which are not <code>ActionForms</code> in a <code>BeanValidatorForm</code>. For example:</p>
- * 
+ *
  * <pre><code>
  *   &lt;form-bean name="myForm" type="org.apache.commons.beanutils.LazyDynaBean"&gt;
  *     &lt;form-property name="myBeans" type="org.apache.commons.beanutils.LazyDynaBean[]" /&gt;
@@ -95,7 +95,7 @@
  *
  * @see <a href="http://jakarta.apache.org/commons/beanutils/apidocs/org/apache/commons/beanutils/package-summary.html#dynamic.lazy">Commons BeanUtils JavaDoc</a>
  * @since Struts 1.2.6
- * @version $Rev$ $Date$ 
+ * @version $Rev$ $Date$
  */
 public class LazyValidatorForm extends BeanValidatorForm {
 

Modified: struts/core/trunk/src/share/org/apache/struts/validator/Resources.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/validator/Resources.java?rev=169091&r1=169090&r2=169091&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/validator/Resources.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/validator/Resources.java Sat May  7 09:11:38 2005
@@ -1,14 +1,14 @@
 /*
- * $Id$ 
+ * $Id$
  *
  * Copyright 2000-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -185,8 +185,8 @@
     }
 
     /**
-     * Gets the locale sensitive message based on the 
-     * <code>ValidatorAction</code> message and the <code>Field</code>'s 
+     * Gets the locale sensitive message based on the
+     * <code>ValidatorAction</code> message and the <code>Field</code>'s
      * arg objects.
      * @param messages  The Message resources
      * @param locale The locale
@@ -255,8 +255,8 @@
     }
 
     /**
-     * Gets the <code>ActionError</code> based on the 
-     * <code>ValidatorAction</code> message and the <code>Field</code>'s 
+     * Gets the <code>ActionError</code> based on the
+     * <code>ValidatorAction</code> message and the <code>Field</code>'s
      * arg objects.
      * @param request the servlet request
      * @param va Validator action
@@ -283,10 +283,10 @@
 
         return new ActionError(msg, args);
     }
-    
+
     /**
-     * Gets the <code>ActionMessage</code> based on the 
-     * <code>ValidatorAction</code> message and the <code>Field</code>'s 
+     * Gets the <code>ActionMessage</code> based on the
+     * <code>ValidatorAction</code> message and the <code>Field</code>'s
      * arg objects.
      * @param request the servlet request
      * @param va Validator action
@@ -313,8 +313,8 @@
     }
 
     /**
-     * Gets the <code>ActionMessage</code> based on the 
-     * <code>ValidatorAction</code> message and the <code>Field</code>'s 
+     * Gets the <code>ActionMessage</code> based on the
+     * <code>ValidatorAction</code> message and the <code>Field</code>'s
      * arg objects.
      * @param validator the Validator
      * @param request the servlet request
@@ -365,7 +365,7 @@
 
 
     /**
-     * Gets the message arguments based on the current 
+     * Gets the message arguments based on the current
      * <code>ValidatorAction</code> and <code>Field</code>.
      * @param actionName action name
      * @param messages message resources
@@ -404,7 +404,7 @@
     }
 
     /**
-     * Gets the message arguments based on the current 
+     * Gets the message arguments based on the current
      * <code>ValidatorAction</code> and <code>Field</code>.
      * @param application the servlet context
      * @param request the servlet request
@@ -449,14 +449,14 @@
     /**
      * Initialize the <code>Validator</code> to perform validation.
      *
-     * @param key The key that the validation rules are under (the form elements 
+     * @param key The key that the validation rules are under (the form elements
      * name attribute).
      * @param bean The bean validation is being performed on.
      * @param application servlet context
      * @param request The current request object.
      * @param errors The object any errors will be stored in.
-     * @param page This in conjunction with  the page property of a 
-     * <code>Field<code> can control the processing of fields.  If the field's 
+     * @param page This in conjunction with  the page property of a
+     * <code>Field<code> can control the processing of fields.  If the field's
      * page is less than or equal to this page value, it will be processed.
      */
     public static Validator initValidator(

Modified: struts/core/trunk/src/share/org/apache/struts/validator/ValidatorActionForm.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/validator/ValidatorActionForm.java?rev=169091&r1=169090&r2=169091&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/validator/ValidatorActionForm.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/validator/ValidatorActionForm.java Sat May  7 09:11:38 2005
@@ -1,14 +1,14 @@
 /*
- * $Id$ 
+ * $Id$
  *
  * Copyright 2000-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Modified: struts/core/trunk/src/share/org/apache/struts/validator/ValidatorForm.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/validator/ValidatorForm.java?rev=169091&r1=169090&r2=169091&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/validator/ValidatorForm.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/validator/ValidatorForm.java Sat May  7 09:11:38 2005
@@ -1,14 +1,14 @@
 /*
- * $Id$ 
+ * $Id$
  *
  * Copyright 2000-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Modified: struts/core/trunk/src/share/org/apache/struts/validator/ValidatorPlugIn.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/validator/ValidatorPlugIn.java?rev=169091&r1=169090&r2=169091&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/validator/ValidatorPlugIn.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/validator/ValidatorPlugIn.java Sat May  7 09:11:38 2005
@@ -1,14 +1,14 @@
 /*
- * $Id$ 
+ * $Id$
  *
  * Copyright 2000-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -212,7 +212,7 @@
                 }
 
                 InputStream input = servlet.getServletContext().getResourceAsStream(validatorRules);
-                
+
                 // If the config isn't in the servlet context, try the class loader
                 // which allows the config files to be stored in a jar
                 if (input == null) {

Modified: struts/core/trunk/src/share/org/apache/struts/validator/validwhen/ValidWhen.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/validator/validwhen/ValidWhen.java?rev=169091&r1=169090&r2=169091&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/validator/validwhen/ValidWhen.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/validator/validwhen/ValidWhen.java Sat May  7 09:11:38 2005
@@ -1,14 +1,14 @@
 /*
- * $Id$ 
+ * $Id$
  *
  * Copyright 2003,2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@
 import org.apache.commons.logging.LogFactory;
 
 /**
- * This class contains the validwhen validation that is used in the 
+ * This class contains the validwhen validation that is used in the
  * validator-rules.xml file.
  *
  * @since Struts 1.2
@@ -53,23 +53,23 @@
     }
 
     /**
-     * Checks if the field matches the boolean expression specified in 
+     * Checks if the field matches the boolean expression specified in
      * <code>test</code> parameter.
      *
      * @param bean The bean validation is being performed on.
-     * 
-     * @param va The <code>ValidatorAction</code> that is currently being 
+     *
+     * @param va The <code>ValidatorAction</code> that is currently being
      *      performed.
-     * 
+     *
      * @param field The <code>Field</code> object associated with the current
      *      field being validated.
-     * 
+     *
      * @param errors The <code>ActionMessages</code> object to add errors to if any
      *      validation errors occur.
-     * 
+     *
      * @param request Current request object.
-     * 
-     * @return <code>true</code> if meets stated requirements, 
+     *
+     * @return <code>true</code> if meets stated requirements,
      *      <code>false</code> otherwise.
      */
     public static boolean validateValidWhen(
@@ -79,12 +79,12 @@
         ActionMessages errors,
         Validator validator,
         HttpServletRequest request) {
-            
+
         Object form = validator.getParameterValue(Validator.BEAN_PARAM);
         String value = null;
         boolean valid = false;
         int index = -1;
-        
+
         if (field.isIndexed()) {
             String key = field.getKey();
 
@@ -96,13 +96,13 @@
                     Integer.parseInt(key.substring(leftBracket + 1, rightBracket));
             }
         }
-        
+
         if (isString(bean)) {
             value = (String) bean;
         } else {
             value = ValidatorUtils.getValueAsString(bean, field.getProperty());
         }
-        
+
         String test = field.getVarValue("test");
         if (test == null) {
             String msg = "ValidWhen Error 'test' parameter is missing for field ' " + field.getKey() + "'";
@@ -110,7 +110,7 @@
             log.error(msg);
             return false;
         }
-        
+
         // Create the Lexer
         ValidWhenLexer lexer= null;
         try {
@@ -143,7 +143,7 @@
         try {
             parser.expression();
             valid = parser.getResult();
-            
+
         } catch (Exception ex) {
 
             // errors.add(
@@ -154,19 +154,19 @@
             errors.add(field.getKey(), new ActionMessage(msg, false));
             log.error(msg);
             log.debug(msg, ex);
-                
+
             return false;
         }
-        
+
         if (!valid) {
             errors.add(
                 field.getKey(),
                 Resources.getActionMessage(validator, request, va, field));
-                
+
             return false;
         }
-        
+
         return true;
     }
-    
+
 }

Modified: struts/core/trunk/src/share/org/apache/struts/validator/validwhen/ValidWhenParser.g
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/validator/validwhen/ValidWhenParser.g?rev=169091&r1=169090&r2=169091&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/validator/validwhen/ValidWhenParser.g (original)
+++ struts/core/trunk/src/share/org/apache/struts/validator/validwhen/ValidWhenParser.g Sat May  7 09:11:38 2005
@@ -1,17 +1,17 @@
 header {
 /*
  * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/validator/validwhen/ValidWhenParser.g,v 1.7 2004/09/03 18:06:58 niallp Exp $
- * $Revision: 1.7 $
+ * $Revision$
  * $Date$
  *
  * Copyright 2003-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,7 +21,7 @@
 
 package org.apache.struts.validator.validwhen;
 
-import java.util.Stack; 
+import java.util.Stack;
 import org.apache.commons.validator.util.ValidatorUtils;
 
 }
@@ -166,10 +166,10 @@
 
 string : str:STRING_LITERAL { argStack.push(str.getText().substring(1, str.getText().length()-1)); };
 
-identifier 
+identifier
 : str:IDENTIFIER { argStack.push(str.getText()); } ;
 
-field 
+field
 : identifier LBRACKET RBRACKET identifier {
             Object i2 = argStack.pop();
             Object i1 = argStack.pop();
@@ -185,7 +185,7 @@
             Object i7 = argStack.pop();
             Object i6 = argStack.pop();
             argStack.push(ValidatorUtils.getValueAsString(form, i6 + "[" + i7 + "]"));
-} 
+}
 | identifier LBRACKET RBRACKET {
             Object i8 = argStack.pop();
             argStack.push(ValidatorUtils.getValueAsString(form, i8 + "[" + index + "]"));
@@ -215,10 +215,10 @@
      }
 };
 
-join : ANDSIGN { argStack.push(new Integer(AND)); } | 
+join : ANDSIGN { argStack.push(new Integer(AND)); } |
         ORSIGN { argStack.push(new Integer(OR)); };
 
-comparison : 
+comparison :
    EQUALSIGN  { argStack.push(new Integer(EQUAL)); } |
    GREATERTHANSIGN { argStack.push(new Integer(GREATER_THAN)); } |
    GREATEREQUALSIGN  { argStack.push(new Integer(GREATER_EQUAL)); } |



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org