You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by js...@apache.org on 2003/08/14 11:44:36 UTC
cvs commit: incubator-geronimo/modules/common/src/java/org/apache/geronimo/common NullArgumentException.java
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 <tt>NullArgumentException</tt> 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 <tt>NullArgumentException</tt>.
*