Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Validators
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9288/src/Spring/Spring.Core/Validation/Validators
Modified Files:
CreditCardValidator.cs EmailValidator.cs ISBNValidator.cs
UrlValidator.cs
Log Message:
Extracted IValidationErrors interface and made ValidationErrors non-sealed.
Added ValidationException class.
Modified email, credit card, isbn and url validators to return true (valid) if object to validate is null or empty.
Index: CreditCardValidator.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Validators/CreditCardValidator.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CreditCardValidator.cs 27 Aug 2007 09:38:56 -0000 1.2
--- CreditCardValidator.cs 5 Feb 2008 20:40:26 -0000 1.3
***************
*** 114,120 ****
{
string text = objectToValidate as string;
! if (text == null)
{
! throw new ArgumentException("Test for CreditCardValidator must evaluate to a string.");
}
--- 114,120 ----
{
string text = objectToValidate as string;
! if (StringUtils.IsNullOrEmpty(text))
{
! return true;
}
Index: UrlValidator.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Validators/UrlValidator.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** UrlValidator.cs 8 Feb 2007 02:18:58 -0000 1.1
--- UrlValidator.cs 5 Feb 2008 20:40:26 -0000 1.2
***************
*** 85,91 ****
{
string text = objectToValidate as string;
! if (text == null)
{
! throw new ArgumentException("Test for UrlValidator must evaluate to a string.");
}
--- 85,91 ----
{
string text = objectToValidate as string;
! if (StringUtils.IsNullOrEmpty(text))
{
! return true;
}
Index: EmailValidator.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Validators/EmailValidator.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EmailValidator.cs 8 Feb 2007 02:18:58 -0000 1.1
--- EmailValidator.cs 5 Feb 2008 20:40:26 -0000 1.2
***************
*** 93,99 ****
{
string text = objectToValidate as string;
! if (text == null)
{
! throw new ArgumentException("Test for EmailValidator must evaluate to a string.");
}
--- 93,99 ----
{
string text = objectToValidate as string;
! if (StringUtils.IsNullOrEmpty(text))
{
! return true;
}
Index: ISBNValidator.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Validation/Validators/ISBNValidator.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ISBNValidator.cs 8 Feb 2007 02:18:58 -0000 1.1
--- ISBNValidator.cs 5 Feb 2008 20:40:26 -0000 1.2
***************
*** 86,92 ****
{
String isbn = objectToValidate as String;
! if (isbn == null)
{
! throw new ArgumentException("Test for ISBNValidator must evaluate to a string.");
}
--- 86,92 ----
{
String isbn = objectToValidate as String;
! if (StringUtils.IsNullOrEmpty(isbn))
{
! return true;
}
|