> > BTW, you can find precedence in the JVM for many methods that throw NPE on > > null arguments. I am not saying this is the "right way", since such things > > are subjective and are a matter of design, but many people have concluded > > it's better. > > If the NPE would not be detected until the method has done some other > work, then I can seem why one might want to detect it earlier. > > And the line number may be insufficient to identify the source of the > NPE - there could be several de-references in a single line.
This is the trade-off which I had mentioned here: > >>> In the end, I'm really not sure what is the best approach for this > >>> particular case. Personally, I'd be happy that the CM code never checks > >>> for > >>> null and let the JVM throw NPE. This would hugely simplify the CM code, > >>> albeit at the cost of detecting bad usage a little later. IMHO, it is not > >>> a > >>> big deal because the bug is that an object is missing somewhere up the > >>> call > >>> stack, and it should be corrected there... Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org