org.codehaus.mojo.exception
Class CodedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.apache.maven.plugin.AbstractMojoExecutionException
              extended by org.apache.maven.plugin.MojoExecutionException
                  extended by org.codehaus.mojo.exception.CodedException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
XmlBeansException

public abstract class CodedException
extends org.apache.maven.plugin.MojoExecutionException

Version:
$Id: CodedException.java 6588 2008-03-28 12:22:57Z bentmann $
Author:
Kris Bravo
See Also:
Serialized Form

Field Summary
protected  Error error
          The error code for the specific error.
protected  java.lang.String[] errorFields
          Any fields which would need to be filled in within the error message.
protected  java.util.ResourceBundle errors
          The shadow handle to the resource bundle.
protected static Error MISSING_ERROR_KEY
          The error message used when a key is missing from the resource bundles.
 
Fields inherited from class org.apache.maven.plugin.AbstractMojoExecutionException
longMessage, source
 
Constructor Summary
CodedException()
          Empty Constructor.
CodedException(Error code)
          An exception with a specific error code.
CodedException(Error code, java.lang.String field)
          An exception with an error code and fields in the message.
CodedException(Error code, java.lang.String[] fields)
          An exception with an error code and fields in the message.
CodedException(Error code, java.lang.String[] fields, java.lang.Throwable exception)
          Creates a coded exception with fields and a root cause.
CodedException(Error code, java.lang.String field, java.lang.Throwable exception)
          Creates a coded exception with fields and a root cause.
CodedException(Error code, java.lang.Throwable exception)
          Creates a new Coded Exception, given an error code and root cause.
 
Method Summary
 java.lang.String getMessage()
          getMessage - Check the error code to see if it's an ExtendedError.
protected  void init(Error code, java.lang.String[] fields)
          Initialize the instance.
 
Methods inherited from class org.apache.maven.plugin.AbstractMojoExecutionException
getLongMessage, getSource
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MISSING_ERROR_KEY

protected static final Error MISSING_ERROR_KEY
The error message used when a key is missing from the resource bundles.


error

protected Error error
The error code for the specific error.


errorFields

protected java.lang.String[] errorFields
Any fields which would need to be filled in within the error message.


errors

protected java.util.ResourceBundle errors
The shadow handle to the resource bundle. Since statics can only be shadowed and not overridden, this provides the mechanism needed to access a subclasses resource bundle from a super-class non-static method.

Constructor Detail

CodedException

public CodedException()
Empty Constructor. Required for subclasses.


CodedException

public CodedException(Error code)
An exception with a specific error code.

Parameters:
code - The code key used to look up the error text.

CodedException

public CodedException(Error code,
                      java.lang.String[] fields)
An exception with an error code and fields in the message.

Parameters:
code - The code key used to look up the error text.
fields - An array of field values to replace fields in the error message.

CodedException

public CodedException(Error code,
                      java.lang.String field)
An exception with an error code and fields in the message.

Parameters:
code - The code key used to look up the error text.
field - A single value with which to replace the error message field.

CodedException

public CodedException(Error code,
                      java.lang.Throwable exception)
Creates a new Coded Exception, given an error code and root cause.

Parameters:
code - The Error of this particular exception.
exception - The root cause of the problem.

CodedException

public CodedException(Error code,
                      java.lang.String field,
                      java.lang.Throwable exception)
Creates a coded exception with fields and a root cause.

Parameters:
code - The code key used to look up the error text.
field - A single value with which to replace the error message field.
exception - The source of the error.

CodedException

public CodedException(Error code,
                      java.lang.String[] fields,
                      java.lang.Throwable exception)
Creates a coded exception with fields and a root cause.

Parameters:
code - The code key used to look up the error text.
fields - An array of field values to replace fields in the error message.
exception - The source of the error.
Method Detail

init

protected final void init(Error code,
                          java.lang.String[] fields)
Initialize the instance.

Parameters:
code - The code key used to look up the error text.
fields - An array of field values to replace fields in the error message.

getMessage

public final java.lang.String getMessage()
getMessage - Check the error code to see if it's an ExtendedError. Based on the result, pull the error string from the appropriate resource bundle (business logic errors or general CAM errors).

Overrides:
getMessage in class java.lang.Throwable
Returns:
a String value


Copyright © 2005-2009. All Rights Reserved.