WebObjects 5.2

com.webobjects.foundation
Class NSForwardException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--com.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, getLocalizedMessage, getMessage
 
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.
Overrides:
printStackTrace in class Throwable

printStackTrace

public void printStackTrace(PrintStream stream)
Prints the original exception and its stack trace to the specified print stream.
Overrides:
printStackTrace in class Throwable
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.
Overrides:
printStackTrace in class Throwable
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.
Overrides:
toString in class Throwable
Returns:
Detailed info regarding the exception message.

Last updated Fri Feb 21 13:15:00 PST 2003.

Copyright © 2003 Apple Computer, Inc.