org.apache.commons.lang
Class NullArgumentException
IllegalArgumentException
org.apache.commons.lang.NullArgumentException
public class NullArgumentException
extends IllegalArgumentException
Thrown to indicate that an argument was
null
and should
not have been.
This exception supplements the standard
IllegalArgumentException
by providing a more semantically rich description of the problem.
NullArgumentException
represents the case where a method takes
in a parameter that must not be
null
.
Some coding standards would use
NullPointerException
for this case,
others will use
IllegalArgumentException
.
Thus this exception would be used in place of
IllegalArgumentException
, yet it still extends it.
public void foo(String str) {
if (str == null) {
throw new NullArgumentException("str");
}
// do something with the string
}
$Id: NullArgumentException.java 161243 2005-04-14 04:30:28Z ggregory $- Matthew Hawthorne
- Stephen Colebourne
NullArgumentException
public NullArgumentException(String argName)
Instantiates with the given argument name.
argName
- the name of the argument that was null
.
Copyright © 2001-2005 - Apache Software Foundation