Author: hardy.ferentschik
Date: 2009-06-18 12:25:46 -0400 (Thu, 18 Jun 2009)
New Revision: 16834
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/impl/PatternValidator.java
Log:
throw the right exception in case the provided regular expression pattern is not valid.
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/impl/PatternValidator.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/impl/PatternValidator.java 2009-06-18
16:25:06 UTC (rev 16833)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/impl/PatternValidator.java 2009-06-18
16:25:46 UTC (rev 16834)
@@ -19,9 +19,9 @@
import java.util.regex.Matcher;
import java.util.regex.PatternSyntaxException;
+import javax.validation.ConstraintDeclarationException;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
-import javax.validation.ValidationException;
import javax.validation.constraints.Pattern;
/**
@@ -42,7 +42,7 @@
pattern = java.util.regex.Pattern.compile( parameters.regexp(), intFlag );
}
catch ( PatternSyntaxException e ) {
- throw new ValidationException( "Invalid regular expression.", e );
+ throw new ConstraintDeclarationException( "Invalid regular expression.", e
);
}
}
Show replies by date