com.simba.dsi.exceptions
Class InvalidArgumentException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.simba.dsi.exceptions.DSIRuntimeException
                  extended by com.simba.dsi.exceptions.InvalidArgumentException
All Implemented Interfaces:
java.io.Serializable

public final class InvalidArgumentException
extends DSIRuntimeException

Thrown when one or more invalid argument has been passed into a method.

See Also:
Serialized Form

Constructor Summary
InvalidArgumentException(int componentId, java.lang.String msgParam)
          Constructor.
InvalidArgumentException(int componentId, java.lang.String msgKey, java.lang.String[] msgParams)
          Constructor.
InvalidArgumentException(java.lang.String message, int nativeErrorCode)
          Constructor.
 
Method Summary
 int getErrorCode()
          Return the vendor error code.
 java.lang.String getLocalizedMessage()
          Overrides Exception's getLocalizedMessage() implementation.
 java.lang.String getMessage()
          Overrides Exception's getMessage() implementation.
 void loadMessage(com.simba.support.IMessageSource messageSource, java.util.Locale locale)
          Loads the error message.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, 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

InvalidArgumentException

public InvalidArgumentException(int componentId,
                                java.lang.String msgParam)
Constructor. This constructor uses the generic DSIMessageKey.INVALID_NULL_ARG message key.

Parameters:
componentId - The component ID.
msgParam - The name of the argument that is invalid.

InvalidArgumentException

public InvalidArgumentException(int componentId,
                                java.lang.String msgKey,
                                java.lang.String[] msgParams)
Constructor. This constructor uses the specified message key.

Parameters:
componentId - The component ID.
msgKey - The message key to use.
msgParams - The parameter(s) that is(are) invalid. Can be null if the specified msgKey does not have any parameters.

InvalidArgumentException

public InvalidArgumentException(java.lang.String message,
                                int nativeErrorCode)
Constructor.

A null message is saved as an empty string.

Parameters:
message - Pre-formatted error message.
nativeErrorCode - The native error code for this error.
Method Detail

getErrorCode

public int getErrorCode()
Return the vendor error code. loadMessage() must have been called if the message has not yet been loaded from a message source.

Returns:
The vendor error code.

getLocalizedMessage

public java.lang.String getLocalizedMessage()
Overrides Exception's getLocalizedMessage() implementation. loadMessage() must have been called if the message has not yet been loaded from a message source.

Overrides:
getLocalizedMessage in class java.lang.Throwable
Returns:
The localized error message.

getMessage

public java.lang.String getMessage()
Overrides Exception's getMessage() implementation. loadMessage() must have been called if the message has not yet been loaded from a message source. NOTE: This override returns the same message as getLocalizedMessage(). All messages are localized.

Overrides:
getMessage in class java.lang.Throwable
Returns:
The localized error message.

loadMessage

public void loadMessage(com.simba.support.IMessageSource messageSource,
                        java.util.Locale locale)
Loads the error message. The message source will be used to construct the message if this exception does not have a preformatted message. If the exception has a preformatted message, messageSource may be null.

Parameters:
messageSource - The message source to use to construct the message.
locale - The locale in which to retrieve the message.


Copyright © 2006-2014 Simba Technologies Incorporated. All Rights Reserved.