diff options
author | Denis <denis@vaadin.com> | 2017-01-16 16:42:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-16 16:42:03 +0200 |
commit | fd92d1f134962fdd3302cd5ad575e072a3dae7bd (patch) | |
tree | 0372a14500ce28f7064ee90bb0e42616c1c24dc2 /server/src/main | |
parent | 352d12d977157f261c2e585e9e0a6f6354812c83 (diff) | |
download | vaadin-framework-fd92d1f134962fdd3302cd5ad575e072a3dae7bd.tar.gz vaadin-framework-fd92d1f134962fdd3302cd5ad575e072a3dae7bd.zip |
Add separate modules to test Bean Validation lib necessity. (#8249)
* Add separate modules to test Bean Validation lib necessity.
Fixes #8141
Diffstat (limited to 'server/src/main')
-rw-r--r-- | server/src/main/java/com/vaadin/data/util/BeanUtil.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/server/src/main/java/com/vaadin/data/util/BeanUtil.java b/server/src/main/java/com/vaadin/data/util/BeanUtil.java index 6faef0ff89..2a6fb4834e 100644 --- a/server/src/main/java/com/vaadin/data/util/BeanUtil.java +++ b/server/src/main/java/com/vaadin/data/util/BeanUtil.java @@ -20,6 +20,7 @@ import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.io.Serializable; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -229,14 +230,21 @@ public final class BeanUtil implements Serializable { private static boolean isAvailable() { try { - Class.forName("javax.validation.Validation"); + Class<?> clazz = Class.forName("javax.validation.Validation"); + Method method = clazz.getMethod("buildDefaultValidatorFactory"); + method.invoke(null); return true; - } catch (ClassNotFoundException e) { + } catch (ClassNotFoundException | NoSuchMethodException + | InvocationTargetException e) { Logger.getLogger(BeanValidator.class.getName()) .fine("A JSR-303 bean validation implementation not found on the classpath. " + BeanValidator.class.getSimpleName() + " cannot be used."); return false; + } catch (IllegalAccessException | IllegalArgumentException e) { + throw new RuntimeException( + "Unable to invoke javax.validation.Validation.buildDefaultValidatorFactory()", + e); } } |