commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <>
Subject Re: [Math] Usage of "NullPointerException"
Date Wed, 04 Aug 2010 22:36:18 GMT
Le 04/08/2010 23:27, Gilles Sadowski a écrit :
>>> 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?

Lets wait from what others think about this.


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

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

View raw message