WebObjects 5.4.2

com.webobjects.foundation
Class NSForwardException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by 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:
NSForwardException.originalException(), Serialized Form

Constructor Summary
NSForwardException(String message, Throwable cause)
          Construct a new exception with the given message and cause.
NSForwardException(Throwable wrapped)
          Creates an NSForwardException from wrapped.
NSForwardException(Throwable wrapped, String extraMessage)
          Creates an NSForwardException from wrapped.
 
Method Summary
 Throwable originalException()
           
 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, printStackTrace, printStackTrace, printStackTrace, 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:
NSForwardException.originalException()

NSForwardException

public NSForwardException(String message,
                          Throwable cause)
Construct a new exception with the given message and cause. This is the same as NSForwardException.NSForwardException(Throwable, String), except the args are in the order expected by standard exception classes.

Parameters:
cause - the original exception
message - description to be attached to the original exception
See Also:
NSForwardException.NSForwardException(Throwable, String), RuntimeException.RuntimeException(String, Throwable)

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:
NSForwardException.originalException()
Method Detail

originalException

public Throwable originalException()
Returns:
the original exception which required a wrapper
See Also:
Throwable.getCause()

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 June 2008

Copyright © 2000-2008 Apple Inc.