jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <>
Subject Re: null checks and ArgumentNullException in report package
Date Mon, 14 Dec 2015 14:14:59 GMT
On 13 December 2015 at 11:10, Felix Schumacher
<> 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

View raw message