FileDocCategorySizeDatePackage
JBossResourceException.javaAPI DocJBoss 4.2.15771Fri Jul 13 21:01:20 BST 2007org.jboss.resource

JBossResourceException

public class JBossResourceException extends javax.resource.ResourceException implements org.jboss.util.NestedThrowable
Thrown to indicate a problem with a resource related operation.

Properly displays linked exception (ie. nested exception) when printing the stack trace.

version
$Revision: 57189 $
author
Jason Dillon

Fields Summary
private static final long
serialVersionUID
The servial version uid
Constructors Summary
public JBossResourceException(String msg)
Construct a JBossResourceException with the specified detail message.

param
msg Detail message.

      super(msg);
   
public JBossResourceException(String msg, String code)
Construct a JBossResourceException with the specified detail message and error code.

param
msg Detail message.
param
code Error code.

      super(msg, code);
   
public JBossResourceException(String msg, String code, Throwable linked)
Construct a JBossResourceException with the specified detail message, error code and linked Exception.

param
msg Detail message.
param
code Error code.
param
linked Linked Exception.

      super(msg, code);
      setLinkedException(process(linked));
   
public JBossResourceException(String msg, Throwable linked)
Construct a JBossResourceException with the specified detail message and linked Exception.

param
msg Detail message.
param
linked Linked Exception.

      super(msg);
      setLinkedException(process(linked));
   
public JBossResourceException(Throwable linked)
Construct a JBossResourceException with the specified linked Exception.

param
linked Linked Exception.

      this(linked.getMessage(), linked);
   
Methods Summary
public java.lang.ThrowablegetCause()
Return the nested Throwable.

For JDK 1.4 compatibility.

return
Nested Throwable.

      return getLinkedException();
   
public java.lang.StringgetMessage()
Returns the composite throwable message.

return
The composite throwable message.

      return NestedThrowable.Util.getMessage(super.getMessage(), getLinkedException());
   
public java.lang.ThrowablegetNested()
Return the nested Throwable.

return
Nested Throwable.

      return getLinkedException();
   
public voidprintStackTrace(java.io.PrintStream stream)
Prints the composite message and the embedded stack trace to the specified print stream.

param
stream Stream to print to.

      Exception linked = getLinkedException();
      if (linked == null || NestedThrowable.PARENT_TRACE_ENABLED)
      {
         super.printStackTrace(stream);
      }
      NestedThrowable.Util.print(linked, stream);
   
public voidprintStackTrace(java.io.PrintWriter writer)
Prints the composite message and the embedded stack trace to the specified print writer.

param
writer Writer to print to.

      Exception linked = getLinkedException();
      if (linked == null || NestedThrowable.PARENT_TRACE_ENABLED)
      {
         super.printStackTrace(writer);
      }
      NestedThrowable.Util.print(linked, writer);
   
public voidprintStackTrace()
Prints the composite message and the embedded stack trace to System.err.

      printStackTrace(System.err);
   
private java.lang.Exceptionprocess(java.lang.Throwable t)

      if (t instanceof Exception)
      {
         return (Exception)t;
      } // end of if ()
      return new UndeclaredThrowableException(t);
   
public static voidrethrowAsResourceException(java.lang.String message, java.lang.Throwable t)
Rethrow as a resource exception if it is not already

param
message the message
param
t the original exception
throws
ResourceException the resource exception

   
                                
           
   
      if (t instanceof ResourceException)
         throw (ResourceException) t;
      else
         throw new JBossResourceException(message, t);