Return-Path: Delivered-To: apmail-incubator-geronimo-cvs-archive@incubator.apache.org Received: (qmail 71715 invoked by uid 500); 14 Aug 2003 09:44:10 -0000 Mailing-List: contact geronimo-cvs-help@incubator.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: geronimo-dev@incubator.apache.org Delivered-To: mailing list geronimo-cvs@incubator.apache.org Received: (qmail 71661 invoked from network); 14 Aug 2003 09:44:10 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 14 Aug 2003 09:44:10 -0000 Received: (qmail 13349 invoked by uid 1315); 14 Aug 2003 09:44:36 -0000 Date: 14 Aug 2003 09:44:36 -0000 Message-ID: <20030814094436.13348.qmail@minotaur.apache.org> From: jstrachan@apache.org To: incubator-geronimo-cvs@apache.org Subject: cvs commit: incubator-geronimo/modules/common/src/java/org/apache/geronimo/common NullArgumentException.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N jstrachan 2003/08/14 02:44:36 Modified: modules/common/src/java/org/apache/geronimo/common NullArgumentException.java Log: added a simple little helper method to check for null and throw an exception Revision Changes Path 1.3 +16 -1 incubator-geronimo/modules/common/src/java/org/apache/geronimo/common/NullArgumentException.java Index: NullArgumentException.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/common/src/java/org/apache/geronimo/common/NullArgumentException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NullArgumentException.java 13 Aug 2003 06:48:45 -0000 1.2 +++ NullArgumentException.java 14 Aug 2003 09:44:36 -0000 1.3 @@ -72,6 +72,21 @@ /** The index of the argument or null if no index. */ protected final Object index; + + /** + * A simple helper method to chekc that the given argument value + * is not null. If it is null then a NullArgumentException is thrown. + * + * @param name name of the argument + * @param argument the value of the argument + * @throws NullArgumentException if the argument is null + */ + public static void checkForNull(String name, Object argument) throws NullArgumentException { + if (argument == null) { + throw new NullArgumentException(name); + } + } + /** * Construct a NullArgumentException. *