Browse Source

Improve logging when bean validation is not available

Closes #9464
tags/8.1.0.beta2
Henri Sara 7 years ago
parent
commit
bdb81a11c6

+ 1
- 1
server/src/main/java/com/vaadin/data/BeanValidationBinder.java View File

@@ -54,7 +54,7 @@ public class BeanValidationBinder<BEAN> extends Binder<BEAN> {
throw new IllegalStateException(
BeanValidationBinder.class.getSimpleName()
+ " cannot be used because a JSR-303 Bean Validation "
+ "implementation not found on the classpath. Use "
+ "implementation not found on the classpath or could not be initialized. Use "
+ Binder.class.getSimpleName() + " instead");
}
this.beanType = beanType;

+ 5
- 3
server/src/main/java/com/vaadin/data/util/BeanUtil.java View File

@@ -24,6 +24,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.vaadin.data.validator.BeanValidator;
@@ -236,10 +237,11 @@ public final class BeanUtil implements Serializable {
return true;
} catch (ClassNotFoundException | NoSuchMethodException
| InvocationTargetException e) {
Logger.getLogger(BeanValidator.class.getName())
.fine("A JSR-303 bean validation implementation not found on the classpath. "
Logger.getLogger(BeanValidator.class.getName()).log(Level.INFO,
"A JSR-303 bean validation implementation not found on the classpath or could not be initialized. "
+ BeanValidator.class.getSimpleName()
+ " cannot be used.");
+ " cannot be used.",
e);
return false;
} catch (IllegalAccessException | IllegalArgumentException e) {
throw new RuntimeException(

Loading…
Cancel
Save