Class ProxoolException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.logicalcobwebs.proxool.ProxoolException
-
- All Implemented Interfaces:
java.io.Serializable
public class ProxoolException extends java.lang.ExceptionProxool exception class that emulates the behaviour of the new cause facility in jdk 1.4. It is also known as the chained exception facility, as the cause can, itself, have a cause, and so on, leading to a "chain" of exceptions, each caused by another.A cause can be associated with a throwable in two ways: via a constructor that takes the cause as an argument, or via the
initCause(Throwable)method. New throwable classes that wish to allow causes to be associated with them should provide constructors that take a cause and delegate (perhaps indirectly) to one of the Throwable constructors that takes a cause.- Since:
- Proxool 0.6
- Version:
- $Revision: 1.2 $, $Date: 2003/03/03 11:11:58 $
- Author:
- Christian Nedregaard (christian_nedregaard@email.com), $Author: billhorsman $ (current maintainer)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ProxoolException()Constructs a new instance withnullas its detail message.ProxoolException(java.lang.String message)Constructs a new instance with the specified detail message.ProxoolException(java.lang.String message, java.lang.Throwable cause)Constructs a new instance with the specified detail message and cause.ProxoolException(java.lang.Throwable cause)Constructs a new throwable with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ThrowablegetCause()Returns the cause of this exception ornullif the cause is nonexistent or unknown.java.lang.ThrowableinitCause(java.lang.Throwable cause)Initializes the cause of this exception to the specified value.voidprintStackTrace()Prints this ProxoolException and its backtrace to the standard error stream.voidprintStackTrace(java.io.PrintStream stream)Prints this ProxoolException and its backtrace to the specified print stream.voidprintStackTrace(java.io.PrintWriter writer)Prints this ProxoolException and its backtrace to the specified print writer.
-
-
-
Constructor Detail
-
ProxoolException
public ProxoolException()
Constructs a new instance withnullas its detail message. The cause is not initialized, and may subsequently be initialized by a call toinitCause(java.lang.Throwable).
-
ProxoolException
public ProxoolException(java.lang.String message)
Constructs a new instance with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call toinitCause(java.lang.Throwable).- Parameters:
message- the detail message. The detail message is saved for later retrieval by theThrowable.getMessage()method.
-
ProxoolException
public ProxoolException(java.lang.String message, java.lang.Throwable cause)Constructs a new instance with the specified detail message and cause.Note that the detail message associated with
causeis not automatically incorporated in this throwable's detail message.- Parameters:
message- the detail message (which is saved for later retrieval by theThrowable.getMessage()method).cause- the cause (which is saved for later retrieval by thegetCause()method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
-
ProxoolException
public ProxoolException(java.lang.Throwable cause)
Constructs a new throwable with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). This constructor is useful for throwables that are little more than wrappers for other throwables.- Parameters:
cause- the cause (which is saved for later retrieval by thegetCause()method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
-
-
Method Detail
-
getCause
public java.lang.Throwable getCause()
Returns the cause of this exception ornullif the cause is nonexistent or unknown. (The cause is the throwable that caused this exception to get thrown.)This implementation returns the cause that was supplied via one of the constructors requiring a Throwable, or that was set after creation with the
initCause(Throwable)method.- Overrides:
getCausein classjava.lang.Throwable- Returns:
- the cause of this throwable or
nullif the cause is nonexistent or unknown.
-
initCause
public java.lang.Throwable initCause(java.lang.Throwable cause)
Initializes the cause of this exception to the specified value. (The cause is the throwable that caused this exception to get thrown.)This method can be called at most once. It is generally called from within the constructor, or immediately after creating the throwable. If this throwable was created with
ProxoolException(Throwable)orProxoolException(String,Throwable), this method cannot be called even once.- Overrides:
initCausein classjava.lang.Throwable- Parameters:
cause- the cause (which is saved for later retrieval by thegetCause()method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)- Returns:
- a reference to this
ProxoolExceptioninstance.
-
printStackTrace
public void printStackTrace()
Prints this ProxoolException and its backtrace to the standard error stream. The backtrace for a ProxoolException with an initialized, non-null cause should generally include the backtrace for the cause.- Overrides:
printStackTracein classjava.lang.Throwable
-
printStackTrace
public void printStackTrace(java.io.PrintStream stream)
Prints this ProxoolException and its backtrace to the specified print stream.- Overrides:
printStackTracein classjava.lang.Throwable- Parameters:
stream-PrintStreamto use for output
-
printStackTrace
public void printStackTrace(java.io.PrintWriter writer)
Prints this ProxoolException and its backtrace to the specified print writer.- Overrides:
printStackTracein classjava.lang.Throwable- Parameters:
writer-PrintWriterto use for output
-
-