wix-incubator / accord

Accord: A sane validation library for Scala
http://wix.github.io/accord/
Other
529 stars 55 forks source link

null BigDecimal validation throws NPE #115

Closed avitaln closed 7 years ago

avitaln commented 7 years ago

this piece of code throw NullPointerException instead of returning a failure

case class Test(price: BigDecimal)
implicit val v = validator[Test] { _.price is notNull and >=[BigDecimal](0) }
validate(Test(null)).isFailure

(because the > is always calculated)

holograph commented 7 years ago

Confirmed. This is actually a little tricker to tackle than you'd expect, but I have a working (though seriously hack-y) solution ready. I'll try to find a cleaner way to deal with this and follow up in a few days.