I am using Oval http://oval.sourceforge.net/ for java bean validations and I'm getting an exception when using the expression language features.
My code looks like this:
@NotNull(errorCode = "paymentCard.number.invalid", message = "Required", when = "_this.cardType != null")
private String cardNumber;
and the outcome is
WARNING: Cannot determine constraint when formula based on annotation $Proxy10
java.lang.ArrayIndexOutOfBoundsException: 1
at net.sf.oval.AbstractCheck.setWhen(AbstractCheck.java:276)
at net.sf.oval.configuration.annotation.AbstractAnnotationCheck.configure(AbstractAnnotationCheck.java:183)
at net.sf.oval.configuration.annotation.AnnotationsConfigurer.initializeCheck(AnnotationsConfigurer.java:323)
at net.sf.oval.configuration.annotation.AnnotationsConfigurer.configureFieldChecks(AnnotationsConfigurer.java:143)
at net.sf.oval.configuration.annotation.AnnotationsConfigurer.getClassConfiguration(AnnotationsConfigurer.java:294)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
31-Jul-2013 18:04:51 net.sf.oval.internal.Log info
INFO: Available ScriptEngine language names: [[js, rhino, JavaScript, javascript, ECMAScript, ecmascript]]
I don't know why this is happening, can anybody help me?
Thanks in advance
You have to write firstly the prefix to indicate Oval which implementation use, but it's also necessary to register the Expression Language implementation you want to use in your project. Without this step Oval won't be able to figure out what implementation you are using to resolve your EL expressions.
private static final Validator VALIDATOR = new Validator();
static {
VALIDATOR.getExpressionLanguageRegistry().registerExpressionLanguage("js",
new ExpressionLanguageJavaScriptImpl());
}