Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 69271 invoked from network); 2 Mar 2011 12:51:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Mar 2011 12:51:10 -0000 Received: (qmail 26715 invoked by uid 500); 2 Mar 2011 12:51:10 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 26112 invoked by uid 500); 2 Mar 2011 12:51:07 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 26104 invoked by uid 99); 2 Mar 2011 12:51:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Mar 2011 12:51:06 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [193.74.71.28] (HELO sif.is.scarlet.be) (193.74.71.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Mar 2011 12:51:00 +0000 Received: from mail.harfang.homelinux.org (ip-62-235-225-219.dsl.scarlet.be [62.235.225.219]) by sif.is.scarlet.be (8.14.2/8.14.2) with ESMTP id p22CobD3004861 for ; Wed, 2 Mar 2011 13:50:38 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scarlet.be; s=scarlet; t=1299070238; bh=wgMK4PLfprGhxB5AFWa0Z0jIwqULpgkFTA28Qc5srTc=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=2KSwjiuJudW3QQlrNXZGiaCFrIJ4TSaaoCb8XbnJMXC4mHiZn/N8sbb/SITGEHyJ1 hvRz2uU5TqPnqNVhIRoyqse1sWJGMy1qncnXIZZ9ulNHM5jTE4E0+gZ/RPeMBzIt9i QrjuCqmu+F0VUMdkeCJmLD34a0tAd9+Mlj4JnXa8= Received: from localhost (mail.harfang.homelinux.org [192.168.20.11]) by mail.harfang.homelinux.org (Postfix) with ESMTP id 7FA78617EE for ; Wed, 2 Mar 2011 13:50:37 +0100 (CET) Received: from mail.harfang.homelinux.org ([192.168.20.11]) by localhost (mail.harfang.homelinux.org [192.168.20.11]) (amavisd-new, port 10024) with ESMTP id xlzl8sBxUFoP for ; Wed, 2 Mar 2011 13:50:35 +0100 (CET) Received: from dusk.harfang.homelinux.org (mail.harfang.homelinux.org [192.168.20.11]) by mail.harfang.homelinux.org (Postfix) with ESMTP id 45539617ED for ; Wed, 2 Mar 2011 13:50:35 +0100 (CET) Received: from eran by dusk.harfang.homelinux.org with local (Exim 4.72) (envelope-from ) id 1PulVi-0007fc-Uf for dev@commons.apache.org; Wed, 02 Mar 2011 13:50:34 +0100 Date: Wed, 2 Mar 2011 13:50:34 +0100 From: Gilles Sadowski To: dev@commons.apache.org Subject: Re: [Math - 403] Never propagate a "NullPointerException" resulting from bad usage of the API Message-ID: <20110302125034.GO22814@dusk.harfang.homelinux.org> Mail-Followup-To: dev@commons.apache.org References: <20110301231236.GI22170@dusk.harfang.homelinux.org> <514CE0C1587E41418D26F4AE7EBAC6EA@BillPC> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Tiny Tux X-PGP-Key-Fingerprint: 53B9 972E C2E6 B93C BEAD 7092 09E6 AF46 51D0 5641 User-Agent: Mutt/1.5.20 (2009-06-14) X-DCC-scarlet.be-Metrics: sif 20002; Body=1 Fuz1=1 Fuz2=1 > > 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-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org