You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by he...@apache.org on 2003/06/19 17:23:43 UTC
cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/intake/validator DateStringValidator.java
henning 2003/06/19 08:23:43
Modified: src/java/org/apache/turbine/services/intake/validator
DateStringValidator.java
Log:
Some init cleanups, modified to work with the new validator class hierarchy.
Patch donated by Colin Chalmers <co...@maxware.nl>
Revision Changes Path
1.6 +30 -11 jakarta-turbine-2/src/java/org/apache/turbine/services/intake/validator/DateStringValidator.java
Index: DateStringValidator.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/validator/DateStringValidator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DateStringValidator.java 7 Apr 2003 15:40:49 -0000 1.5
+++ DateStringValidator.java 19 Jun 2003 15:23:43 -0000 1.6
@@ -86,6 +86,7 @@
*
* @author <a href="mailto:jmcnally@collab.net">John McNally</a>
* @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
+ * @author <a href="mailto:Colin.Chalmers@maxware.nl">Colin Chalmers</a>
* @version $Id$
*/
public class DateStringValidator
@@ -94,29 +95,45 @@
private static final String DEFAULT_DATE_MESSAGE =
"Date could not be parsed";
- private List dateFormats;
- private String dateFormatMessage;
- private boolean flexible;
- private DateFormat df;
- private SimpleDateFormat sdf;
+ /** */
+ private List dateFormats = null;
+
+ /** */
+ private String dateFormatMessage = null;
+
+ /** */
+ private boolean flexible = false;
+
+ /** */
+ private DateFormat df = null;
+
+ /** */
+ private SimpleDateFormat sdf = null;
public DateStringValidator(Map paramMap)
throws IntakeException
{
- this();
init(paramMap);
}
+ /**
+ * Default Constructor
+ */
public DateStringValidator()
{
- super();
+ dateFormats = new ArrayList(5);
}
+ /**
+ * Constructor to use when initialising Object
+ *
+ * @param paramMap
+ * @throws InvalidMaskException
+ */
public void init(Map paramMap)
throws InvalidMaskException
{
super.init(paramMap);
- dateFormats = new ArrayList(5);
Constraint constraint = (Constraint) paramMap.get("format");
@@ -168,16 +185,18 @@
* @exception ValidationException containing an error message if the
* testValue did not pass the validation tests.
*/
- protected void doAssertValidity(String testValue)
+ public void assertValidity(String testValue)
throws ValidationException
{
+ super.assertValidity(testValue);
+
try
{
parse(testValue);
}
catch (ParseException e)
{
- message = dateFormatMessage;
+ errorMessage = dateFormatMessage;
throw new ValidationException(dateFormatMessage);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org