Orbital library

orbital.util
Class InnerCheckedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by orbital.util.InnerCheckedException
All Implemented Interfaces:
java.io.Serializable

public class InnerCheckedException
extends java.lang.RuntimeException

This class is a InnerCheckedException which can be thrown if checked exceptions occur which cannot be declared in the throws-clause of a method, and must be wrapped in an unchecked RuntimeException to rethrow, instead.

This techique should only be used if a method-signature is required - for instance by the java.lang.Runnable interface - that does not allow the declaration of checked exceptions. The rethrow technique breaks a good java feature of checked exceptions. A method which uses InnerCheckedExceptions will break its exception contract. It is not a good style to use it except for signature requirements.

For example:

 public void run() {
     try {
         ...
     }
     catch(AnyCheckedException x) {throw new InnerCheckedException(x);}
 }
 

Author:
André Platzer
See Also:
Throwable.getCause(), Throwable.initCause(Throwable), UndeclaredThrowableException, InvocationTargetException, Serialized Form

Field Summary
protected  java.lang.Throwable nested
          nested inner exception that is checked and therefore cannot be thrown directly.
 
Constructor Summary
InnerCheckedException(java.lang.String message, java.lang.Throwable cause)
           
InnerCheckedException(java.lang.Throwable inner)
           
InnerCheckedException(java.lang.Throwable cause, java.lang.String message)
          Deprecated. Since JDK1.4 use InnerCheckedException(String, Throwable) instead.
 
Method Summary
 java.lang.Throwable getNextException()
          Deprecated. Use Throwable.getCause() instead.
 void printStackTrace()
          Prints the stack trace of the thrown nested exception to the specified print stream.
 void printStackTrace(java.io.PrintStream ps)
          Prints the stack trace of the thrown nested exception to the specified print stream.
 void printStackTrace(java.io.PrintWriter pw)
          Prints the stack trace of the thrown nested exception to the specified print writer.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nested

protected java.lang.Throwable nested
nested inner exception that is checked and therefore cannot be thrown directly.

Constructor Detail

InnerCheckedException

public InnerCheckedException(java.lang.Throwable inner)

InnerCheckedException

public InnerCheckedException(java.lang.String message,
                             java.lang.Throwable cause)

InnerCheckedException

public InnerCheckedException(java.lang.Throwable cause,
                             java.lang.String message)
Deprecated. Since JDK1.4 use InnerCheckedException(String, Throwable) instead.

Method Detail

getNextException

public java.lang.Throwable getNextException()
Deprecated. Use Throwable.getCause() instead.

Get the inner nested exception thrown.


printStackTrace

public void printStackTrace()
Prints the stack trace of the thrown nested exception to the specified print stream.

Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintStream ps)
Prints the stack trace of the thrown nested exception to the specified print stream.

Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintWriter pw)
Prints the stack trace of the thrown nested exception to the specified print writer.

Overrides:
printStackTrace in class java.lang.Throwable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Throwable

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.