You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dg...@apache.org on 2003/08/12 02:29:35 UTC
cvs commit: jakarta-commons/validator/src/example/org/apache/commons/validator/example ValidateExample.java validator-example.xml
dgraham 2003/08/11 17:29:35
Modified: validator/src/share/org/apache/commons/validator
ValidatorResources.java
validator/src/test/org/apache/commons/validator
validator-locale.xml
validator-multiple-config-1.xml EmailTest.java
ByteTest.java FloatTest.java
validator-multiple-config-2.xml
validator-multipletest.xml
MultipleConfigFilesTest.java DoubleTest.java
validator-regexp.xml LongTest.java LocaleTest.java
validator-requiredif.xml RequiredIfTest.java
MultipleTests.java validator-name-required.xml
validator-type.xml TypeTest.java
RequiredNameTest.java IntegerTest.java
validator-numeric.xml ShortTest.java
validator/src/example/org/apache/commons/validator/example
ValidateExample.java validator-example.xml
Log:
ValidatorResources now uses a validating Digester to parse the validation
XML files. If the files are not valid or well formed, a SAXException is thrown
and the parsing stops.
Revision Changes Path
1.25 +18 -16 jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorResources.java
Index: ValidatorResources.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorResources.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ValidatorResources.java 3 Aug 2003 17:29:40 -0000 1.24
+++ ValidatorResources.java 12 Aug 2003 00:29:34 -0000 1.25
@@ -150,9 +150,12 @@
*
* @param in InputStream to a validation.xml configuration file. It's the client's
* responsibility to close this stream.
+ * @throws IOException
+ * @throws SAXException if the validation XML files are not valid or well
+ * formed.
* @since Validator 1.1
*/
- public ValidatorResources(InputStream in) throws IOException {
+ public ValidatorResources(InputStream in) throws IOException, SAXException {
this(new InputStream[] { in });
}
@@ -162,15 +165,20 @@
* @param streams An array of InputStreams to several validation.xml
* configuration files that will be read in order and merged into this object.
* It's the client's responsibility to close these streams.
+ * @throws IOException
+ * @throws SAXException if the validation XML files are not valid or well
+ * formed.
* @since Validator 1.1
*/
- public ValidatorResources(InputStream[] streams) throws IOException {
+ public ValidatorResources(InputStream[] streams)
+ throws IOException, SAXException {
+
super();
-
+
URL rulesUrl = this.getClass().getResource("digester-rules.xml");
Digester digester = DigesterLoader.createDigester(rulesUrl);
digester.setNamespaceAware(true);
- digester.setValidating(false);
+ digester.setValidating(true);
digester.setUseContextClassLoader(true);
// register DTDs
@@ -183,15 +191,9 @@
for (int i = 0; i < streams.length; i++) {
digester.push(this);
-
- try {
- digester.parse(streams[i]);
-
- } catch (SAXException e) {
- log.error(e.getMessage(), e);
- }
+ digester.parse(streams[i]);
}
-
+
this.process();
}
1.3 +6 -1 jakarta-commons/validator/src/test/org/apache/commons/validator/validator-locale.xml
Index: validator-locale.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-locale.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- validator-locale.xml 25 May 2003 18:00:23 -0000 1.2
+++ validator-locale.xml 12 Aug 2003 00:29:34 -0000 1.3
@@ -1,9 +1,14 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+
<form-validation>
<global>
<validator name="required"
classname="org.apache.commons.validator.TestValidator"
method="validateRequired"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
</global>
<formset>
<form name="nameForm" >
1.3 +9 -2 jakarta-commons/validator/src/test/org/apache/commons/validator/validator-multiple-config-1.xml
Index: validator-multiple-config-1.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-multiple-config-1.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- validator-multiple-config-1.xml 22 May 2003 02:52:47 -0000 1.2
+++ validator-multiple-config-1.xml 12 Aug 2003 00:29:34 -0000 1.3
@@ -1,3 +1,7 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+
<!--
This first config file only contains the validator definitions. This
separation is how Struts does things.
@@ -7,10 +11,13 @@
<validator name="int"
classname="org.apache.commons.validator.TestValidator"
method="validateInt"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
+
<validator name="required"
classname="org.apache.commons.validator.TestValidator"
method="validateRequired"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
</global>
</form-validation>
1.16 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java
Index: EmailTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- EmailTest.java 3 Aug 2003 17:39:11 -0000 1.15
+++ EmailTest.java 12 Aug 2003 00:29:34 -0000 1.16
@@ -70,6 +70,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
* <p>Performs Validation Test for e-mail validations.</p>
@@ -128,7 +129,7 @@
* Load <code>ValidatorResources</code> from
* validator-regexp.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.10 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/ByteTest.java
Index: ByteTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/ByteTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ByteTest.java 3 Aug 2003 17:39:11 -0000 1.9
+++ ByteTest.java 12 Aug 2003 00:29:34 -0000 1.10
@@ -71,6 +71,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
@@ -129,7 +130,7 @@
* Load <code>ValidatorResources</code> from
* validator-numeric.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.10 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/FloatTest.java
Index: FloatTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/FloatTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FloatTest.java 3 Aug 2003 17:39:11 -0000 1.9
+++ FloatTest.java 12 Aug 2003 00:29:34 -0000 1.10
@@ -71,6 +71,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
@@ -129,7 +130,7 @@
* Load <code>ValidatorResources</code> from
* validator-numeric.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.4 +4 -0 jakarta-commons/validator/src/test/org/apache/commons/validator/validator-multiple-config-2.xml
Index: validator-multiple-config-2.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-multiple-config-2.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- validator-multiple-config-2.xml 25 May 2003 18:00:23 -0000 1.3
+++ validator-multiple-config-2.xml 12 Aug 2003 00:29:34 -0000 1.4
@@ -1,3 +1,7 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+
<!--
This second config file only contains the formset definitions.
-->
1.3 +10 -2 jakarta-commons/validator/src/test/org/apache/commons/validator/validator-multipletest.xml
Index: validator-multipletest.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-multipletest.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- validator-multipletest.xml 25 May 2003 18:00:23 -0000 1.2
+++ validator-multipletest.xml 12 Aug 2003 00:29:34 -0000 1.3
@@ -1,14 +1,22 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+
<form-validation>
<global>
<validator name="int"
classname="org.apache.commons.validator.TestValidator"
method="validateInt"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
+
<validator name="required"
classname="org.apache.commons.validator.TestValidator"
method="validateRequired"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
</global>
+
<formset>
<form name="nameForm">
<field property="firstName" depends="required">
1.6 +6 -4 jakarta-commons/validator/src/test/org/apache/commons/validator/MultipleConfigFilesTest.java
Index: MultipleConfigFilesTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/MultipleConfigFilesTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MultipleConfigFilesTest.java 28 May 2003 04:28:00 -0000 1.5
+++ MultipleConfigFilesTest.java 12 Aug 2003 00:29:34 -0000 1.6
@@ -64,6 +64,8 @@
import java.io.IOException;
import java.io.InputStream;
+import org.xml.sax.SAXException;
+
import junit.framework.TestCase;
/**
@@ -100,7 +102,7 @@
/**
* Load <code>ValidatorResources</code> from multiple xml files.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
InputStream[] streams =
new InputStream[] {
this.getClass().getResourceAsStream(
1.10 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/DoubleTest.java
Index: DoubleTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/DoubleTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DoubleTest.java 3 Aug 2003 17:39:11 -0000 1.9
+++ DoubleTest.java 12 Aug 2003 00:29:34 -0000 1.10
@@ -71,6 +71,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
@@ -129,7 +130,7 @@
* Load <code>ValidatorResources</code> from
* validator-numeric.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.2 +6 -1 jakarta-commons/validator/src/test/org/apache/commons/validator/validator-regexp.xml
Index: validator-regexp.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-regexp.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- validator-regexp.xml 2 Apr 2002 01:59:44 -0000 1.1
+++ validator-regexp.xml 12 Aug 2003 00:29:34 -0000 1.2
@@ -1,9 +1,14 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+
<form-validation>
<global>
<validator name="email"
classname="org.apache.commons.validator.TestValidator"
method="validateEmail"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
</global>
<formset>
<form name="emailForm">
1.10 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/LongTest.java
Index: LongTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/LongTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- LongTest.java 3 Aug 2003 17:39:11 -0000 1.9
+++ LongTest.java 12 Aug 2003 00:29:34 -0000 1.10
@@ -71,6 +71,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
@@ -129,7 +130,7 @@
* Load <code>ValidatorResources</code> from
* validator-numeric.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.8 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/LocaleTest.java
Index: LocaleTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/LocaleTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- LocaleTest.java 3 Aug 2003 17:39:11 -0000 1.7
+++ LocaleTest.java 12 Aug 2003 00:29:34 -0000 1.8
@@ -72,6 +72,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
* <p>Performs Validation Test for <code>long</code> validations.</p>
@@ -129,7 +130,7 @@
* Load <code>ValidatorResources</code> from
* validator-locale.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.4 +6 -1 jakarta-commons/validator/src/test/org/apache/commons/validator/validator-requiredif.xml
Index: validator-requiredif.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-requiredif.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- validator-requiredif.xml 25 May 2003 18:00:23 -0000 1.3
+++ validator-requiredif.xml 12 Aug 2003 00:29:34 -0000 1.4
@@ -1,9 +1,14 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+
<form-validation>
<global>
<validator name="requiredif"
classname="org.apache.commons.validator.TestValidator"
method="validateRequiredIf"
- methodParams="java.lang.Object,org.apache.commons.validator.Field,org.apache.commons.validator.Validator"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field,org.apache.commons.validator.Validator"
+ msg=""/>
</global>
<formset>
<form name="nameForm">
1.9 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/RequiredIfTest.java
Index: RequiredIfTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/RequiredIfTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- RequiredIfTest.java 3 Aug 2003 17:39:11 -0000 1.8
+++ RequiredIfTest.java 12 Aug 2003 00:29:34 -0000 1.9
@@ -71,6 +71,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
* <p>Performs Validation Test.</p>
@@ -128,7 +129,7 @@
* Load <code>ValidatorResources</code> from
* validator-requiredif.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.9 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/MultipleTests.java
Index: MultipleTests.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/MultipleTests.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MultipleTests.java 3 Aug 2003 17:39:11 -0000 1.8
+++ MultipleTests.java 12 Aug 2003 00:29:34 -0000 1.9
@@ -71,6 +71,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
* <p>Performs Validation Test.</p>
@@ -128,7 +129,7 @@
* Load <code>ValidatorResources</code> from
* validator-multipletest.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.5 +6 -1 jakarta-commons/validator/src/test/org/apache/commons/validator/validator-name-required.xml
Index: validator-name-required.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-name-required.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- validator-name-required.xml 3 Aug 2003 17:42:58 -0000 1.4
+++ validator-name-required.xml 12 Aug 2003 00:29:34 -0000 1.5
@@ -1,9 +1,14 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+
<form-validation>
<global>
<validator name="required"
classname="org.apache.commons.validator.TestValidator"
method="validateRequired"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
</global>
<formset>
<form name="nameForm">
1.3 +16 -6 jakarta-commons/validator/src/test/org/apache/commons/validator/validator-type.xml
Index: validator-type.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-type.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- validator-type.xml 30 Mar 2002 05:13:12 -0000 1.2
+++ validator-type.xml 12 Aug 2003 00:29:34 -0000 1.3
@@ -1,34 +1,44 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+
<form-validation>
<global>
<validator name="byte"
classname="org.apache.commons.validator.TestTypeValidator"
method="validateByte"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
<validator name="short"
classname="org.apache.commons.validator.TestTypeValidator"
method="validateShort"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
<validator name="int"
classname="org.apache.commons.validator.TestTypeValidator"
method="validateInt"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
<validator name="long"
classname="org.apache.commons.validator.TestTypeValidator"
method="validateLong"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
<validator name="float"
classname="org.apache.commons.validator.TestTypeValidator"
method="validateFloat"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
<validator name="double"
classname="org.apache.commons.validator.TestTypeValidator"
method="validateDouble"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
</global>
<formset>
1.11 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/TypeTest.java
Index: TypeTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/TypeTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TypeTest.java 3 Aug 2003 17:39:11 -0000 1.10
+++ TypeTest.java 12 Aug 2003 00:29:34 -0000 1.11
@@ -73,6 +73,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
@@ -131,7 +132,7 @@
* Load <code>ValidatorResources</code> from
* validator-type.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.11 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/RequiredNameTest.java
Index: RequiredNameTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/RequiredNameTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RequiredNameTest.java 28 May 2003 04:28:00 -0000 1.10
+++ RequiredNameTest.java 12 Aug 2003 00:29:34 -0000 1.11
@@ -71,6 +71,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
@@ -129,7 +130,7 @@
* Load <code>ValidatorResources</code> from
* validator-name-required.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.10 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/IntegerTest.java
Index: IntegerTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/IntegerTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- IntegerTest.java 3 Aug 2003 17:39:11 -0000 1.9
+++ IntegerTest.java 12 Aug 2003 00:29:34 -0000 1.10
@@ -71,6 +71,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
@@ -129,7 +130,7 @@
* Load <code>ValidatorResources</code> from
* validator-numeric.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.2 +16 -6 jakarta-commons/validator/src/test/org/apache/commons/validator/validator-numeric.xml
Index: validator-numeric.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-numeric.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- validator-numeric.xml 30 Mar 2002 04:21:03 -0000 1.1
+++ validator-numeric.xml 12 Aug 2003 00:29:34 -0000 1.2
@@ -1,34 +1,44 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+
<form-validation>
<global>
<validator name="byte"
classname="org.apache.commons.validator.TestValidator"
method="validateByte"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
<validator name="short"
classname="org.apache.commons.validator.TestValidator"
method="validateShort"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
<validator name="int"
classname="org.apache.commons.validator.TestValidator"
method="validateInt"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
<validator name="long"
classname="org.apache.commons.validator.TestValidator"
method="validateLong"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
<validator name="float"
classname="org.apache.commons.validator.TestValidator"
method="validateFloat"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
<validator name="double"
classname="org.apache.commons.validator.TestValidator"
method="validateDouble"
- methodParams="java.lang.Object,org.apache.commons.validator.Field"/>
+ methodParams="java.lang.Object,org.apache.commons.validator.Field"
+ msg=""/>
</global>
<formset>
1.10 +6 -5 jakarta-commons/validator/src/test/org/apache/commons/validator/ShortTest.java
Index: ShortTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/ShortTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ShortTest.java 3 Aug 2003 17:39:11 -0000 1.9
+++ ShortTest.java 12 Aug 2003 00:29:34 -0000 1.10
@@ -71,6 +71,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
/**
@@ -129,7 +130,7 @@
* Load <code>ValidatorResources</code> from
* validator-numeric.xml.
*/
- protected void setUp() throws IOException {
+ protected void setUp() throws IOException, SAXException {
// Load resources
InputStream in = null;
1.14 +14 -12 jakarta-commons/validator/src/example/org/apache/commons/validator/example/ValidateExample.java
Index: ValidateExample.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/example/org/apache/commons/validator/example/ValidateExample.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ValidateExample.java 8 Jun 2003 07:11:25 -0000 1.13
+++ ValidateExample.java 12 Aug 2003 00:29:34 -0000 1.14
@@ -77,26 +77,27 @@
import org.apache.commons.validator.ValidatorResources;
import org.apache.commons.validator.ValidatorResult;
import org.apache.commons.validator.ValidatorResults;
+import org.xml.sax.SAXException;
/**
* <p>A simple example of setting up and using the Validator.</p>
*
- * @author James Turner
- * @version $Revision$ $Date$
- *
* This simple example shows all the steps needed to set up and use
* the Validator. Note that in most cases, some kind of framework
* would be wrapped around the Validator, such as is the case with
* the Struts Validator Framework. However, should you wish to use
* the Validator against raw Beans in a pure Java application, you
* can see everything you need to know to get it working here.
- *
-*/
+ *
+ * @author James Turner
+ * @version $Revision$ $Date$
+ */
public class ValidateExample extends Object {
/**
- * We need a resource bundle to get our field names and errors messages from. Note that this is not strictly
- * required to make the Validator work, but is a good coding practice.
+ * We need a resource bundle to get our field names and errors messages
+ * from. Note that this is not strictly required to make the Validator
+ * work, but is a good coding practice.
*/
private static ResourceBundle apps =
ResourceBundle.getBundle(
@@ -105,9 +106,10 @@
/**
* This is the main method that will be called to initialize the Validator, create some sample beans, and
* run the Validator against them.
- *
*/
- public static void main(String[] args) throws IOException, ValidatorException {
+ public static void main(String[] args)
+ throws ValidatorException, IOException, SAXException {
+
InputStream in = null;
ValidatorResources resources = null;
1.3 +4 -0 jakarta-commons/validator/src/example/org/apache/commons/validator/example/validator-example.xml
Index: validator-example.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/example/org/apache/commons/validator/example/validator-example.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- validator-example.xml 25 May 2003 18:00:24 -0000 1.2
+++ validator-example.xml 12 Aug 2003 00:29:34 -0000 1.3
@@ -1,3 +1,7 @@
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">
+
<form-validation>
<global>
<validator name="int"
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org