You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by rl...@apache.org on 2002/05/22 22:08:04 UTC
cvs commit: jakarta-struts/src/share/org/apache/struts/util IteratorAdapter.java
rleland 02/05/22 13:08:03
Modified: contrib/validator/src/share/org/apache/struts/validator/util
StrutsValidator.java
doc volunteers.xml
doc/userGuide volunteers.xml
src/share/org/apache/struts/util IteratorAdapter.java
Log:
Trivial: But Important spell my boss's name correctly :-}
Revision Changes Path
1.4 +125 -125 jakarta-struts/contrib/validator/src/share/org/apache/struts/validator/util/StrutsValidator.java
Index: StrutsValidator.java
===================================================================
RCS file: /home/cvs/jakarta-struts/contrib/validator/src/share/org/apache/struts/validator/util/StrutsValidator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StrutsValidator.java 17 Mar 2002 00:36:43 -0000 1.3
+++ StrutsValidator.java 22 May 2002 20:08:03 -0000 1.4
@@ -51,8 +51,8 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-
-
+
+
package org.apache.struts.validator.util;
import java.io.Serializable;
@@ -70,7 +70,7 @@
/**
- * <p>This class performs validations. The methods are can be configured to be
+ * <p>This class performs validations. The methods are can be configured to be
* used in the framework in the validation.xml file. (See example webapp)</p>
*
* @author David Winterfeldt
@@ -81,22 +81,22 @@
* Commons Logging instance.
*/
private static Log LOG = LogSource.getInstance(StrutsValidator.class.getName());
-
+
/**
- * <p>Checks if the field isn't null and length of the field is greater than zero not
+ * <p>Checks if the field isn't null and length of the field is greater than zero not
* including whitespace.</p>
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateRequired(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateRequired(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
String value = null;
@@ -108,7 +108,7 @@
return false;
} else {
- return true;
+ return true;
}
}
@@ -117,29 +117,29 @@
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateMask(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateMask(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
-
+
String mask = field.getVarValue("mask");
-
+
if (field.getProperty() != null && field.getProperty().length() > 0) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
-
+
try {
if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.matchRegexp(value, mask)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
-
+
return false;
} else {
- return true;
+ return true;
}
} catch (RESyntaxException e) {
LOG.error(e.getMessage(), e);
@@ -147,34 +147,34 @@
LOG.error(e.getMessage(), e);
}
}
-
+
return true;
- }
-
+ }
+
/**
* <p>Checks if the field can safely be converted to a byte primitive.</p>
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateByte(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateByte(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
-
+
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.isByte(value)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
return false;
} else {
- return true;
+ return true;
}
}
@@ -183,23 +183,23 @@
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateShort(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateShort(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
-
+
if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.isShort(value)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
return false;
} else {
- return true;
+ return true;
}
}
@@ -208,23 +208,23 @@
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateInteger(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateInteger(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
-
+
if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.isInt(value)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
return false;
} else {
- return true;
+ return true;
}
}
@@ -233,23 +233,23 @@
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
- */
- public static boolean validateLong(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ */
+ public static boolean validateLong(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
-
+
if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.isLong(value)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
return false;
} else {
- return true;
+ return true;
}
}
@@ -258,23 +258,23 @@
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateFloat(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateFloat(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
-
+
if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.isFloat(value)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
return false;
} else {
- return true;
+ return true;
}
}
@@ -283,47 +283,47 @@
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateDouble(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateDouble(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
-
+
if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.isDouble(value)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
return false;
} else {
- return true;
+ return true;
}
}
/**
- * <p>Checks if the field is a valid date. If the field has a datePattern variable,
- * that will be used to format <code>java.text.SimpleDateFormat</code>. If the field
- * has a datePatternStrict variable, that will be used to format
- * <code>java.text.SimpleDateFormat</code> and the length will be checked so '2/12/1999'
+ * <p>Checks if the field is a valid date. If the field has a datePattern variable,
+ * that will be used to format <code>java.text.SimpleDateFormat</code>. If the field
+ * has a datePatternStrict variable, that will be used to format
+ * <code>java.text.SimpleDateFormat</code> and the length will be checked so '2/12/1999'
* will not pass validation with the format 'MM/dd/yyyy' because the month isn't two digits.
- * If no datePattern variable is specified, then the field gets the DateFormat.SHORT
- * format for the locale. The setLenient method is set to <code>false</code> for all
+ * If no datePattern variable is specified, then the field gets the DateFormat.SHORT
+ * format for the locale. The setLenient method is set to <code>false</code> for all
* variations.</p>
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateDate(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateDate(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
boolean bValid = true;
@@ -349,30 +349,30 @@
if (!bValid)
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
-
+
return bValid;
- }
+ }
/**
- * <p>Checks if a fields value is within a range (min & max specified
+ * <p>Checks if a fields value is within a range (min & max specified
* in the vars attribute).</p>
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateRange(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateRange(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
-
+
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
String sMin = field.getVarValue("min");
String sMax = field.getVarValue("max");
@@ -382,10 +382,10 @@
int iValue = Integer.parseInt(value);
int min = Integer.parseInt(sMin);
int max = Integer.parseInt(sMax);
-
+
if (!GenericValidator.isInRange(iValue, min, max)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
-
+
return false;
}
} catch (Exception e) {
@@ -393,7 +393,7 @@
return false;
}
}
-
+
return true;
}
@@ -404,26 +404,26 @@
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateCreditCard(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateCreditCard(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
-
+
if (field.getProperty() != null && field.getProperty().length() > 0) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
-
+
if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.isCreditCard(value)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
-
+
return false;
} else {
- return true;
+ return true;
}
} else {
return true;
@@ -432,24 +432,24 @@
/**
* <p>Checks if a field has a valid e-mail address.</p>
- * <p>Based on a script by Sandeep V. Tamhankar (stamhankar@hotmail.com),
+ * <p>Based on a script by Sandeep V. Tamhankar (stamhankar@hotmail.com),
* http://javascript.internet.com</p>
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateEmail(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateEmail(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
-
+
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
-
+
if (!GenericValidator.isBlankOrNull(value) && !GenericValidator.isEmail(value)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
return false;
@@ -459,20 +459,20 @@
}
/**
- * <p>Checks if the field's length is less than or equal to the maximum value. A <code>Null</code>
+ * <p>Checks if the field's length is less than or equal to the maximum value. A <code>Null</code>
* will be considered an error.</p>
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateMaxLength(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateMaxLength(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
@@ -481,10 +481,10 @@
if (value != null) {
try {
int max = Integer.parseInt(sMaxLength);
-
+
if (!GenericValidator.maxLength(value, max)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
-
+
return false;
}
} catch (Exception e) {
@@ -492,26 +492,26 @@
return false;
}
}
-
+
return true;
}
/**
- * <p>Checks if the field's length is greater than or equal to the minimum value.
+ * <p>Checks if the field's length is greater than or equal to the minimum value.
* A <code>Null</code> will be considered an error.</p>
*
* @param bean The bean validation is being performed on.
* @param va The <code>ValidatorAction</code> that is currently being performed.
- * @param field The <code>Field</code> object associated with the current field
+ * @param field The <code>Field</code> object associated with the current field
* being validated.
- * @param errors The <code>ActionErrors</code> object to add errors to if any
+ * @param errors The <code>ActionErrors</code> object to add errors to if any
* validation errors occur.
* @param request Current request object.
*/
- public static boolean validateMinLength(Object bean,
- ValidatorAction va, Field field,
- ActionErrors errors,
+ public static boolean validateMinLength(Object bean,
+ ValidatorAction va, Field field,
+ ActionErrors errors,
HttpServletRequest request) {
String value = ValidatorUtil.getValueAsString(bean, field.getProperty());
@@ -520,10 +520,10 @@
if (value != null) {
try {
int min = Integer.parseInt(sMinLength);
-
+
if (!GenericValidator.minLength(value, min)) {
errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field));
-
+
return false;
}
} catch (Exception e) {
@@ -531,7 +531,7 @@
return false;
}
}
-
+
return true;
}
1.6 +1 -1 jakarta-struts/doc/volunteers.xml
Index: volunteers.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/doc/volunteers.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- volunteers.xml 4 May 2002 07:10:57 -0000 1.5
+++ volunteers.xml 22 May 2002 20:08:03 -0000 1.6
@@ -35,7 +35,7 @@
<li>Niall Pemberton</li>
<li>Ralph Schaer</li>
<li>Rob Leland</li>
-<li>Sean M. Kelly</li>
+<li>Sean M. Kelley</li>
<li>Ted Husted</li>
</ul>
</section>
1.9 +1 -1 jakarta-struts/doc/userGuide/volunteers.xml
Index: volunteers.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/doc/userGuide/volunteers.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- volunteers.xml 4 May 2002 07:00:23 -0000 1.8
+++ volunteers.xml 22 May 2002 20:08:03 -0000 1.9
@@ -35,7 +35,7 @@
<li>Niall Pemberton</li>
<li>Ralph Schaer</li>
<li>Rob Leland</li>
-<li>Sean M. Kelly</li>
+<li>Sean M. Kelley</li>
<li>Ted Husted</li>
</ul>
</section>
1.2 +5 -5 jakarta-struts/src/share/org/apache/struts/util/IteratorAdapter.java
Index: IteratorAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/IteratorAdapter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IteratorAdapter.java 31 Mar 2001 19:51:17 -0000 1.1
+++ IteratorAdapter.java 22 May 2002 20:08:03 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/IteratorAdapter.java,v 1.1 2001/03/31 19:51:17 rleland Exp $
- * $Revision: 1.1 $
- * $Date: 2001/03/31 19:51:17 $
+ * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/IteratorAdapter.java,v 1.2 2002/05/22 20:08:03 rleland Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/05/22 20:08:03 $
*
* ====================================================================
*
@@ -70,9 +70,9 @@
* throw an UnsupportedOperationException. Added for use by TagLib so
* Enumeration can be supported
*
- * @author Sean Kelly
+ * @author Sean M. Kelley
* @author Rob Leland
- * @version $Revision: 1.1 $ $Date: 2001/03/31 19:51:17 $
+ * @version $Revision: 1.2 $ $Date: 2002/05/22 20:08:03 $
*/
public class IteratorAdapter implements Iterator {
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>