Rickard Öberg wrote: > Well, the way this was done in the previous implementation was to do > try/catch NPE around the constraint invocation, specifically so that the > constraint itself did not have to do null checks (they should be as > simplistic as possible). So, the best way to do this is actually to add > try/catch NPE in all places where isValid is called, and consider an NPE > to be a constraint failure. > > I'll do that immediately. Easy to do. > > /Rickard
Should we really do that? So we won't get an NPE if this NPE comes from an implementation error in the constraint***, but a valid result (false in this case). I think we should add the null check to the expression like I did it: OLD: value.trim().length() > 0; NEW: (null != value) && (value.trim().length() > 0); which is also 'simplistic' and the Constraint#isValid javadoc should state that 'value' can be null. Georg *** Consider somebody is going to create his own complex constraint with an implementation error showing up as NPE, which then would be hidden. _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

