1

I'm using OVAL as object validation framework in my project. Let's say I have the following object:

public class MyObject {

    @NotNull(message = "Amount cannot be null.")
    @NotNegative(when = "groovy:((_value != null) && (_value.getAmount() <= 0))", message = "Amount cannot be ZERO or negative.")
    private Currency amount;
}

Without specifying (_value != null) in @NotNegative annotation it fails with java.lang.NullPointerException even though there is additional @NotNull annotation which should check that case.

Is it possible somehow to avoid that duplication?

Wild One
  • 751
  • 1
  • 5
  • 11

1 Answers1

0

Checks should be ignored if the field is null. You should open a bug report at http://sourceforge.net/p/oval/bugs/

mattelacchiato
  • 317
  • 3
  • 11