de.smartics.util.lang
Class NullArgumentException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by java.lang.NullPointerException
                  extended by de.smartics.util.lang.NullArgumentException
All Implemented Interfaces:
Serializable

public class NullArgumentException
     
     
extends NullPointerException

Signals that a given argument is null where is must no be null.

Due to Java conventions the exception does not derive from IllegalArgumentException as one might expect.

If a caller passes null in some parameter for which null values are prohibited, convention dictates that NullPointerException be thrown rather than IllegalArgumentException.

Effective Java - Second Edition, p 248

See Also:
Serialized Form

Constructor Summary
NullArgumentException()
          Convenience constructor if no argument name needs to be provided.
NullArgumentException(String argName)
          Convenience constructor.
NullArgumentException(String argName, String message)
          Default constructor.
 
Method Summary
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NullArgumentException

public NullArgumentException()
Convenience constructor if no argument name needs to be provided. This constructor is not recommended since the exception's message is less verbose.


NullArgumentException

public NullArgumentException(String argName)
Convenience constructor.

Parameters:
argName - the name of the argument that was null.

NullArgumentException

public NullArgumentException(String argName,
                             String message)
Default constructor.

Parameters:
argName - the name of the argument that was null.
message - an optional additional message to provide information about the context of the argument.
See Also:
IllegalArgumentException.IllegalArgumentException(java.lang.String)


Copyright © 2011–2013 smartics. All rights reserved.