On 13 December 2015 at 11:10, Felix Schumacher
<[email protected]> wrote:
> Hi all,
>
> in the new report package, there are a lot of null-checks of the sort
>
> if (foo == null) {
>  throw new ArgumentNullException("foo");
> }
>
> The ArgumentNullException is a new class from report.core.
>
> We could use Validate.notNull() from commons lang3 instead. It will throw an
> NullPointerException, when a null value is found.
>
> What do you think?

That's better than using a new Exception class.

However, if the point where the NPE would be thrown is near where the
NPE would be raised if the check were *not* done, it might be better
to just remove the check.

Null argument checks are perhaps best reserved for locations where it
would otherwise be tricky to determine where the null originated.

> Regards,
>  Felix

Reply via email to