codec
Class InconsistentStateException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--codec.InconsistentStateException
All Implemented Interfaces:
Serializable

public class InconsistentStateException
extends RuntimeException

Signals an inconsistent object state. Objects can enter inconsistent states for instance if an exception is caught that shouldn't happen. Such exceptions can occur due to unexpected exceptions from other code or internal errors.

A typical example is when an application knows that a specific error condition cannot occur because the preconditions required for a successful completion of a method call are met, but an exception is thrown nevertheless. In this case, the exception can be caught and wrapped into an exception of this class in order to pass on the original cause of the exception to code further up the calling stack.

Version:
"$Id: InconsistentStateException.java,v 1.3 2005/04/06 09:33:26 flautens Exp $"
Author:
Volker Roth
See Also:
Serialized Form

Constructor Summary
InconsistentStateException()
          Creates an instance.
InconsistentStateException(Exception e)
          Creates an exception that wraps around the given exception.
InconsistentStateException(String message)
          Creates an instance with the given message.
 
Method Summary
 Exception getException()
          Returns the wrapped exception or this if no exception is wrapped in this one.
 void printStackTrace()
          Prints the stack trace of this exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, printStackTrace, printStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InconsistentStateException

public InconsistentStateException()
Creates an instance.

InconsistentStateException

public InconsistentStateException(String message)
Creates an instance with the given message.
Parameters:
message - The message.

InconsistentStateException

public InconsistentStateException(Exception e)
Creates an exception that wraps around the given exception. The message of this exception is set to the one of the given exception. The given exception must not be null.
Parameters:
e - The exception that shall be wrapped in this one.
Throws:
NullPointerException - if the given exception is null.
Method Detail

getException

public Exception getException()
Returns the wrapped exception or this if no exception is wrapped in this one.
Returns:
The wrapped exception or this if there is no exception wrapped by this one.

printStackTrace

public void printStackTrace()
Prints the stack trace of this exception. If this exception has a wrapped exception then the stack trace of the wrapped exception is printed instead of the one of this exception. Since this exception was created in the course of catching the wrapped exception, the location where this exception was thrown is included in the stack trace of the wrapped exception.
Overrides:
printStackTrace in class Throwable


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.