From dev-return-7644-apmail-directory-dev-archive=directory.apache.org@directory.apache.org Wed Aug 31 18:23:59 2005 Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 97552 invoked from network); 31 Aug 2005 18:23:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Aug 2005 18:23:58 -0000 Received: (qmail 6417 invoked by uid 500); 31 Aug 2005 18:23:54 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 6262 invoked by uid 500); 31 Aug 2005 18:23:53 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 6208 invoked by uid 99); 31 Aug 2005 18:23:53 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Aug 2005 11:23:53 -0700 X-ASF-Spam-Status: No, hits=1.9 required=10.0 tests=DNS_FROM_RFC_POST,FROM_ENDS_IN_NUMS,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of aok123@bellsouth.net designates 205.152.59.72 as permitted sender) Received: from [205.152.59.72] (HELO imf24aec.mail.bellsouth.net) (205.152.59.72) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Aug 2005 11:24:07 -0700 Received: from ibm71aec.bellsouth.net ([65.80.200.112]) by imf24aec.mail.bellsouth.net with ESMTP id <20050831182350.GBJL6137.imf24aec.mail.bellsouth.net@ibm71aec.bellsouth.net> for ; Wed, 31 Aug 2005 14:23:50 -0400 Received: from [172.16.1.152] (really [65.80.200.112]) by ibm71aec.bellsouth.net with ESMTP id <20050831182350.ZBFP11623.ibm71aec.bellsouth.net@[172.16.1.152]> for ; Wed, 31 Aug 2005 14:23:50 -0400 Message-ID: <4315F5B2.1070406@bellsouth.net> Date: Wed, 31 Aug 2005 14:23:46 -0400 From: Alex Karasulu User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@directory.apache.org Subject: [OT] How best to respond to null arguments? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi all, I was playing again with my very many split personalities when I realized one likes to throw NullPointerExceptions after checking if an argument is null while another likes to throw IllegalArgumentExceptions since null is value the argument can take. Yet another personality does not care and figures a NPE will result anyway when the null argument is referenced so why bother. Question: How best to respond to null arguments? Option #1: Ignore it and let a NPE result on its own Option #2: Test to see if arg is null early and throw a descriptive NPE Option #3: Test to see if arg is null early and throw a descriptive IAE Which sounds best? Alex