commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <>
Subject Re: [Math] Usage of "NullPointerException"
Date Wed, 04 Aug 2010 21:27:05 GMT
> > A simpler policy would be to not check for "null" and let the JVM do it. As
> > the JVM will do it anyway, it's a redundant check when the reference is not
> > null, i.e. most of time (in legitimate usage).
> This simpler policy seems fine to me.
> However, it is an important change from previous behaviour.

In practice it is not that important: there are currently only 29
occurrences of messages referring to "null"; among those only 6 raise a
NullPointerException (the others throw an IllegalArgumentException).

> > When the usage is wrong, the error is obvious and always the same ("null
> > reference") and the "NullPointerException" fully identify the problem. I
> > don't see why we should have a localized version of it. Yes, again, there
> > are detailed messages saying:
> >  "the covariance matrix cannot be null"
> >  "the function cannot be null"
> >  "the denominator cannot be null"
> >  etc.
> > But since any reference can potentially be "null", do you really intend to
> > have a specific meesage for every object?
> For these very low level errors, I would be happy with the single
> message from JVM.

So, shall I remove all checks for "null" (and those items in
"LocalizedFormats" that are used for reporting it)?
Should I open a JIRA issue?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message