commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: [Math] Usage of "NullPointerException"
Date Thu, 05 Aug 2010 10:34:28 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.
> 
> Sorry, I am not sure I understand what you mean by the "simpler
> policy."  Which one do you mean:
> 
> 0) remove null checks uniformly and just let NPEs propagate everywhere

Yes.

> 1) remove NPE wrappers, propagating uwrapped NPEs where the code
> wraps and rethrows NPE today.

I don't understand this. I didn't find occurrences where a NPE is wrapped
into something else.

> 2) other?
> 
> I am -1 on 0), since this would result in loss of FFC info available
> in the cases where we rethrow NPE as IAE with an exception message
> indicating which argument was null (like the examples below).

What does FFC mean?
I think that using IAE instead of NPE does not bring any added value. It
justs goes against standard usage: throw NPE when a reference is "null"
and is not allowed to be so.
As proposed in
  https://issues.apache.org/jira/browse/MATH-401
we could still do explicit checks for "null" but nevertheless throw the
standard (non-specific and non localized) NPE.

> [...]

Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message