Class CakeException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- de.uni_trier.wi2.procake.utils.exception.CakeException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CakeIOException,CakeSaxException,ClassHierarchyConsistencyException,ClassNotFoundException,IllegalEditException,IllegalInstantiationException,IndexOutOfBoundsException,InterruptedException,InvalidNativeValueException,InvalidSemanticDescriptorException,InvalidTypeException,ItemNotFoundException,NameAlreadyExistsException,NameNotFoundException,NoSemanticDescriptorException,NoSequentialGraphException,NoSuchAttributeException,NoSuchAttributeValueException,ObjectAlreadyExistsException,ObjectNotFoundException,UncomparableObjectsException
public class CakeException extends RuntimeException
A CakeException extendsExceptionwith additional information. This information include the component, the key, the caller, and additional parameters. They can be used by theLoggerin respect by theMessageFormatter. Especially the logger provides special methods to log an CAKE exception, seeLogger.log(Level, CakeException).The component and the key should be defined with the same concept as for the
Logger. But the exceptions are not logged automatically. To log an CakeException the exception has to be catched and logged manually:try { // some code that throws an CakeException } catch (CakeException ex) { cake.logger.LoggerFactory.getLogger(ex.getComponent()).log(Level.INFO, ex); }- Author:
- Rainer Maximini
- See Also:
Logger,MessageFormatter, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CakeException(CakeException e)CakeException(String message, Object caller, Object... parameters)CakeException(String component, String key, Object caller)CakeException(String component, String key, Object caller, Object parameter1)CakeException(String component, String key, Object caller, Object[] parameters)CakeException(String component, String key, Object caller, Object parameter1, Object parameter2)CakeException(String component, String key, Object caller, Object parameter1, Object parameter2, Object parameter3)CakeException(String component, String key, Object caller, Object parameter1, Object parameter2, Object parameter3, Object parameter4)CakeException(String message, Throwable cause, Object caller, Object... parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetCaller()StringgetComponent()StringgetDetailedMessage()StringgetKey()ObjectgetParameter(int index)Object[]getParameters()-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
CakeException
public CakeException(String message, Throwable cause, Object caller, Object... parameters)
- Parameters:
message- message the detail message (which is saved for later retrieval by theThrowable.getMessage()method)cause- the cause (which is saved for later retrieval by theThrowable.getCause()method)caller- the caller of the exception (which is saved for later retrieval by thegetCaller()method)parameters- an array of parameters (which is saved for later retrieval by thegetParameters()method)
-
CakeException
public CakeException(String message, Object caller, Object... parameters)
- Parameters:
message- message the detail message (which is saved for later retrieval by theThrowable.getMessage()method)caller- the caller of the exception (which is saved for later retrieval by thegetCaller()method)parameters- an array of parameters (which is saved for later retrieval by thegetParameters()method)
-
CakeException
public CakeException(CakeException e)
-
CakeException
public CakeException(String component, String key, Object caller)
- Parameters:
component- the log compomentkey- the log keycaller- the caller of the exception- See Also:
Logger
-
CakeException
public CakeException(String component, String key, Object caller, Object[] parameters)
- Parameters:
component- the log compomentkey- the log keycaller- the caller of the exceptionparameters- an array of parameters- See Also:
Logger
-
CakeException
public CakeException(String component, String key, Object caller, Object parameter1)
- Parameters:
component- the log compomentkey- the log keycaller- the caller of the exceptionparameter1- the first parameter- See Also:
Logger
-
CakeException
public CakeException(String component, String key, Object caller, Object parameter1, Object parameter2)
- Parameters:
component- the log compomentkey- the log keycaller- the caller of the exceptionparameter1- the first parameterparameter2- the first parameter- See Also:
Logger
-
CakeException
public CakeException(String component, String key, Object caller, Object parameter1, Object parameter2, Object parameter3)
- Parameters:
component- the log compomentkey- the log keycaller- the caller of the exceptionparameter1- the first parameterparameter2- the first parameterparameter3- the first parameter- See Also:
Logger
-
CakeException
public CakeException(String component, String key, Object caller, Object parameter1, Object parameter2, Object parameter3, Object parameter4)
- Parameters:
component- the log compomentkey- the log keycaller- the caller of the exceptionparameter1- the first parameterparameter2- the first parameterparameter3- the first parameterparameter4- the first parameter- See Also:
Logger
-
-
Method Detail
-
getDetailedMessage
public String getDetailedMessage()
- Returns:
- detailed message with further information about caller and parameters
-
getCaller
public Object getCaller()
- Returns:
- Returns the caller.
-
getParameters
public Object[] getParameters()
- Returns:
- Returns the parameters.
-
getParameter
public Object getParameter(int index)
- Returns:
- Return a specific parameter.
-
getComponent
public String getComponent()
- Returns:
- Returns the component.
-
getKey
public String getKey()
- Returns:
- Returns the key.
-
-