我正在使用 Oval http://oval.sourceforge.net/进行 Java bean 验证,并且在使用表达式语言功能时出现异常。
我的代码如下所示:
@NotNull(errorCode = "paymentCard.number.invalid", message = "Required", when = "_this.cardType != null")
private String cardNumber;
结果是
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]]
我不知道为什么会发生这种情况,有人可以帮助我吗?
提前致谢