You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by mb...@apache.org on 2018/03/07 00:05:02 UTC
bval git commit: ensure all exceptions thrown by ConstraintValidators
are wrapped in ValidationExceptions
Repository: bval
Updated Branches:
refs/heads/bv2 a63f3d5e0 -> 31a63ef13
ensure all exceptions thrown by ConstraintValidators are wrapped in ValidationExceptions
Project: http://git-wip-us.apache.org/repos/asf/bval/repo
Commit: http://git-wip-us.apache.org/repos/asf/bval/commit/31a63ef1
Tree: http://git-wip-us.apache.org/repos/asf/bval/tree/31a63ef1
Diff: http://git-wip-us.apache.org/repos/asf/bval/diff/31a63ef1
Branch: refs/heads/bv2
Commit: 31a63ef1303df93849cf8c32b142d630babea8e5
Parents: a63f3d5
Author: Matt Benson <mb...@apache.org>
Authored: Tue Mar 6 18:03:47 2018 -0600
Committer: Matt Benson <mb...@apache.org>
Committed: Tue Mar 6 18:03:47 2018 -0600
----------------------------------------------------------------------
.../main/java/org/apache/bval/jsr/job/ValidationJob.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/bval/blob/31a63ef1/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidationJob.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidationJob.java b/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidationJob.java
index 088f69d..87542f4 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidationJob.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidationJob.java
@@ -135,8 +135,14 @@ public abstract class ValidationJob<T> {
// null validator without exception implies composition:
valid = true;
} else {
- constraintValidator.initialize(constraint.getAnnotation());
- valid = constraintValidator.isValid(context.getValue(), constraintValidatorContext);
+ try {
+ constraintValidator.initialize(constraint.getAnnotation());
+ valid = constraintValidator.isValid(context.getValue(), constraintValidatorContext);
+ } catch (ValidationException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ValidationException(e);
+ }
}
if (!valid) {
constraintValidatorContext.getRequiredViolations().forEach(sink);