Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 67081 invoked from network); 29 Jun 2002 20:52:59 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by 209.66.108.5 with SMTP; 29 Jun 2002 20:52:59 -0000 Received: (qmail 15823 invoked by uid 97); 29 Jun 2002 20:53:12 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 15786 invoked by uid 97); 29 Jun 2002 20:53:11 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 15774 invoked by uid 98); 29 Jun 2002 20:53:11 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <007f01c21faf$13ef8f80$ad1a29d9@oemcomputer> From: "Stephen Colebourne" To: "Jakarta Commons Developers List" References: Subject: Re: [lang] NullArgumentException? Date: Sat, 29 Jun 2002 21:53:52 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Spam-Rating: 209.66.108.5 1.6.2 0/1000/N X-Spam-Rating: 209.66.108.5 1.6.2 0/1000/N From: "Michael A. Smith" > On Sat, 29 Jun 2002, Stephen Colebourne wrote: > > I would like to add a NullArgumentException class to the lang.exceptions > > package. > > > > It would be a subclass of IllegalArgumentException. > > It would be thrown when null is passed in as an argument when it shouldn't > > be. > > > > Any objections? > > That's what java.lang.NullPointerException is for. "Applications should > throw instances of this class to indicate other illegal uses of the null > object." I have to reasons for not wanting to use NullPointerException. 1) NullPointerException is an unplanned exception. Its thrown by the runtime automatically, with no control over the error message. Overloading its use for specifically validated exceptions is not good. 2) The Collection API doesn't allow NullPointerException to be thrown for a rejection of null entry into a collection. It states it must be IllegalArgumentException. In both cases NullArgumentException would make life clearer. Stephen -- To unsubscribe, e-mail: For additional commands, e-mail: