WebObjects 5.2.3

com.webobjects.foundation
Class NSForwardException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.RuntimeException
              extended bycom.webobjects.foundation.NSForwardException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
WOXMLException

public class NSForwardException
extends RuntimeException

NSForwardException objects (or forwarded exceptions) are wrappers for Throwable objects which are not RuntimeExceptions. Since NSForwardException is a subclass of RuntimeException, forwarded exceptions are usually omitted from the throws clause of a method even if the original exception would have had to be declared.

NSForwardException is used within WebObjects to keep the API congruent with the WebObjects 4.5 API (which uses the Java Bridge). Apple doesn't anticipate the need for you to create NSForwardException objects. You may need to catch them, however.

See Also:
originalException(), Serialized Form

Constructor Summary
NSForwardException(Throwable wrapped)
          Creates an NSForwardException from wrapped.
NSForwardException(Throwable wrapped, String extraMessage)
          Creates an NSForwardException from wrapped.
 
Method Summary
 Throwable originalException()
           
 void printStackTrace()
          Prints the original exception and its stack trace to the standard error stream.
 void printStackTrace(PrintStream stream)
          Prints the original exception and its stack trace to the specified print stream.
 void printStackTrace(PrintWriter writer)
          Prints the original exception and its stack trace to the specified print writer.
 String stackTrace()
           
 String toString()
          Returns a string representation of the receiver indicating the receiver's class, its wrapped exception's class, and the wrapped exception's error message string.
 
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
 

Constructor Detail

NSForwardException

public NSForwardException(Throwable wrapped,
                          String extraMessage)
Creates an NSForwardException from wrapped. If wrapped is already an NSForwardException, the constructor wraps the exception's original exception.

The two-argument constructor allows you to specify an extra message; in this case, the new NSForwardException's message is wrapped's message with extraMessage appended.

Parameters:
wrapped - the original exception
extraMessage - description to be attached to the original exception
See Also:
originalException()

NSForwardException

public NSForwardException(Throwable wrapped)
Creates an NSForwardException from wrapped. If wrapped is already an NSForwardException, the constructor wraps the exception's originalException.

Parameters:
wrapped - the original exception
See Also:
originalException()
Method Detail

originalException

public Throwable originalException()
Returns:
the original exception which required a wrapper

printStackTrace

public void printStackTrace()
Prints the original exception and its stack trace to the standard error stream.


printStackTrace

public void printStackTrace(PrintStream stream)
Prints the original exception and its stack trace to the specified print stream.

Parameters:
stream - the exception returned from the receiver

printStackTrace

public void printStackTrace(PrintWriter writer)
Prints the original exception and its stack trace to the specified print writer.

Parameters:
writer - the printing device manager

stackTrace

public String stackTrace()
Returns:
a string containing the wrapped exception and its stack trace

toString

public String toString()
Returns a string representation of the receiver indicating the receiver's class, its wrapped exception's class, and the wrapped exception's error message string.

Returns:
Detailed info regarding the exception message.

Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.