org.openmdx.base.exception
Class RuntimeServiceException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.openmdx.base.exception.RuntimeServiceException
All Implemented Interfaces:
Serializable, BasicException.Wrapper, MultiLineStringRepresentation

public final class RuntimeServiceException
extends RuntimeException
implements BasicException.Wrapper

This class wrappes a ServiceException for cases where only RuntimeExceptions but no ServiceExceptions are allowed.

Author:
H. Burger
See Also:
Serialized Form

Constructor Summary
RuntimeServiceException(BasicException exception)
          Constructor
RuntimeServiceException(Exception exception)
          Constructor
RuntimeServiceException(Exception cause, String exceptionDomain, int exceptionCode, BasicException.Parameter[] parameters, String description)
          Creates a new RuntimeServiceException.
RuntimeServiceException(ServiceException exception)
          Rewraps the ServiceException's StackedException
RuntimeServiceException(String exceptionDomain, int exceptionCode, BasicException.Parameter[] parameters, String description)
          Creates a new RuntimeServiceException.
 
Method Summary
 RuntimeServiceException appendCause(Throwable cause)
           
 Throwable getCause()
          Returns the cause of an exception.
 BasicException getCause(String exceptionDomain)
          Returns the cause belonging to a specific exception domain.
 int getExceptionCode()
          Retrieves the exception code of this ServiceException.
 String getExceptionDomain()
          Retrieves the exception domain of this ServiceException.
 BasicException getExceptionStack()
          Return a StackedException, this exception object's cause.
 String getMessage()
          Returns the detail message string of this RuntimeServiceException.
 ServiceException getServiceException()
          Deprecated. use new
 BasicException getStackedException()
          Deprecated. use getExceptionStack()
 Throwable initCause(Throwable cause)
          Initializes the cause of this throwable to the specified value.
 RuntimeServiceException log()
          Log the exception at warning level.
 void printStackTrace(PrintStream s)
           
 void printStackTrace(PrintWriter s)
           
 String toString()
          A String consisting of the class of this exception, the exception domain, the exception code, the exception description and the exception stack.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RuntimeServiceException

public RuntimeServiceException(BasicException exception)
Constructor

Parameters:
exception - the Exception to be wrapped

RuntimeServiceException

public RuntimeServiceException(Exception exception)
Constructor

Parameters:
exception - the Exception to be wrapped

RuntimeServiceException

public RuntimeServiceException(ServiceException exception)
Rewraps the ServiceException's StackedException

This constructor could be eliminated in favour of RuntimeServiceException(Exception exception) if recompile was enforced.

Parameters:
exception - The ServiceException to be wrapped

RuntimeServiceException

public RuntimeServiceException(Exception cause,
                               String exceptionDomain,
                               int exceptionCode,
                               BasicException.Parameter[] parameters,
                               String description)
Creates a new RuntimeServiceException.

Parameters:
cause - The exception cause.
exceptionDomain - The exception domain or null for the default exception domain containing negative exception codes only.
exceptionCode - The exception code. Negative codes are shared by all exception domains, while positive ones are (non-default) exception domain specific.
parameters - The exception specific parameters.
description - A readable description usually not including the parameters.

RuntimeServiceException

public RuntimeServiceException(String exceptionDomain,
                               int exceptionCode,
                               BasicException.Parameter[] parameters,
                               String description)
Creates a new RuntimeServiceException.

Parameters:
exceptionDomain - The exception domain or null for the default exception domain containing negative exception codes only.
exceptionCode - The exception code. Negative codes are shared by all exception domains, while positive ones are (non-default) exception domain specific.
parameters - The exception specific parameters.
message - A readable description not including the parameters.
Method Detail

log

public RuntimeServiceException log()
Log the exception at warning level.

Returns:
this RuntimeServiceException

appendCause

public RuntimeServiceException appendCause(Throwable cause)

getStackedException

public final BasicException getStackedException()
Deprecated. use getExceptionStack()

Returns:
the StackedException wrapped by this object.

getExceptionStack

public BasicException getExceptionStack()
Return a StackedException, this exception object's cause.

Specified by:
getExceptionStack in interface BasicException.Wrapper
Returns:
the StackedException wrapped by this object.

getExceptionDomain

public String getExceptionDomain()
Retrieves the exception domain of this ServiceException.

Specified by:
getExceptionDomain in interface BasicException.Wrapper
Returns:
the exception domain

getExceptionCode

public int getExceptionCode()
Retrieves the exception code of this ServiceException.

Specified by:
getExceptionCode in interface BasicException.Wrapper
Returns:
the exception code

getCause

public BasicException getCause(String exceptionDomain)
Returns the cause belonging to a specific exception domain.

Specified by:
getCause in interface BasicException.Wrapper
Parameters:
exceptionDomain - the desired exception domain, or null to retrieve the initial cause.
Returns:
Either the cause belonging to a specific exception domain or the initial cause if exceptionDomain is null.

getMessage

public String getMessage()
Returns the detail message string of this RuntimeServiceException.

Specified by:
getMessage in interface BasicException.Wrapper
Overrides:
getMessage in class Throwable
Returns:
the detail message string of this Wrapper exception instance (which may be null).

toString

public String toString()
A String consisting of the class of this exception, the exception domain, the exception code, the exception description and the exception stack.

Overrides:
toString in class Throwable
Returns:
a multiline representation of this exception.

initCause

public Throwable initCause(Throwable cause)
Initializes the cause of this throwable to the specified value. (The cause is the throwable that caused this throwable to get thrown.)

Overrides:
initCause in class Throwable
Parameters:
cause - the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
Returns:
a reference to this RuntimeServiceException instance.
Throws:
IllegalArgumentException - if cause is this throwable. (A throwable cannot be its own cause.)
IllegalStateException - if the cause is already set.

getCause

public Throwable getCause()
Returns the cause of an exception. The cause actually is the wrapped exception.

Overrides:
getCause in class Throwable
Returns:
Throwable The exception cause.

printStackTrace

public void printStackTrace(PrintStream s)
Overrides:
printStackTrace in class Throwable

printStackTrace

public void printStackTrace(PrintWriter s)
Overrides:
printStackTrace in class Throwable

getServiceException

public ServiceException getServiceException()
Deprecated. use new

Convert this RuntimeServiceException to a ServiceException



This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.