Skip to content

Commit

Permalink
Trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Dec 20, 2024
1 parent 47c6acb commit 1c8351b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
30 changes: 15 additions & 15 deletions src/example/org/apache/commons/validator/example/ValidateBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.apache.commons.validator.example;

/**
/**
* A simple bean to use with the Validator Example.
*/
public class ValidateBean {
Expand All @@ -26,63 +26,63 @@ public class ValidateBean {
public void setLastName(String lastName) {
this.lastName = lastName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public void setStreet1(String street1) {
this.street1 = street1;
}

public void setStreet2(String street2) {
this.street2 = street2;
}

public void setCity(String city) {
this.city = city;
}

public void setState(String state) {
this.state = state;
}

public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}

public void setAge(String age) {
this.age = age;
}

public String getLastName() {
return this.lastName;
}

public String getFirstName() {
return this.firstName;
}

public String getStreet1() {
return this.street1;
}

public String getStreet2() {
return this.street2;
}

public String getCity() {
return this.city;
}

public String getState() {
return this.state;
}

public String getPostalCode() {
return this.postalCode;
}

public String getAge() {
return this.age;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import org.apache.commons.validator.ValidatorResults;
import org.xml.sax.SAXException;

/**
* <p>A simple example of setting up and using the Validator.</p>
/**
* <p>A simple example of setting up and using the Validator.</p>
*
* This simple example shows all the steps needed to set up and use
* the Validator. Note that in most cases, some kind of framework
Expand All @@ -46,8 +46,8 @@
public class ValidateExample {

/**
* 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
* 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 =
Expand All @@ -60,46 +60,46 @@ public class ValidateExample {
*/
public static void main(String[] args)
throws ValidatorException, IOException, SAXException {

InputStream in = null;
ValidatorResources resources = null;

try {

// Create a new instance of a ValidatorResource, then get a stream
// handle on the XML file with the actions in it, and initialize the
// resources from it. This would normally be done by a servlet
// run during JSP initialization or some other application-startup
// routine.
in = ValidateExample.class.getResourceAsStream("validator-example.xml");
resources = new ValidatorResources(in);

} finally {
// Make sure we close the input stream.
if (in != null) {
in.close();
}
}

// Create a test bean to validate against.
ValidateBean bean = new ValidateBean();

// Create a validator with the ValidateBean actions for the bean
// we're interested in.
Validator validator = new Validator(resources, "ValidateBean");

// Tell the validator which bean to validate against.
validator.setParameter(Validator.BEAN_PARAM, bean);

ValidatorResults results = null;

// Run the validation actions against the bean. Since all of the properties
// are null, we expect them all to error out except for street2, which has
// no validations (it's an optional property)

results = validator.validate();
printResults(bean, results, resources);

// Now set all the required properties, but make the age a non-integer.
// You'll notice that age will pass the required test, but fail the int
// test.
Expand All @@ -112,12 +112,12 @@ public static void main(String[] args)
bean.setAge("Too Old");
results = validator.validate();
printResults(bean, results, resources);

// Now only report failed fields
validator.setOnlyReturnErrors(true);
results = validator.validate();
printResults(bean, results, resources);

// Now everything should pass.
validator.setOnlyReturnErrors(false);
bean.setAge("123");
Expand All @@ -132,7 +132,7 @@ public static void printResults(
ValidateBean bean,
ValidatorResults results,
ValidatorResources resources) {

boolean success = true;

// Start by getting the form for the current locale and Bean.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public RegexValidator getRegexValidator() {
* Note: the IBAN PDF registry file implies that IBANs can contain lower-case letters.
* However, several other documents state that IBANs must be upper-case only.
* [See the comment block following this array.]
*
*
* In the Regexes below, only upper-case is used.
*/
private static final Validator[] DEFAULT_VALIDATORS = { //
Expand Down

0 comments on commit 1c8351b

Please sign in to comment.