Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2006, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.jboss.resource;
 
 
 
Thrown to indicate a problem with a resource related operation.

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

Author(s):
Jason Dillon
Version:
$Revision: 76129 $
 
 public class JBossResourceException
    extends ResourceException
    implements NestedThrowable
 {
   
The servial version ui
 
    private static final long serialVersionUID = 6614203184612359692L;
   
   
Rethrow as a resource exception if it is not already

Parameters:
message the message
t the original exception
Throws:
javax.resource.ResourceException the resource exception
 
    public static void rethrowAsResourceException(String messageThrowable tthrows ResourceException
    {
       if (t instanceof ResourceException)
          throw (ResourceExceptiont;
       else
          throw new JBossResourceException(messaget);
    }
   
   
Construct a JBossResourceException with the specified detail message.

Parameters:
msg Detail message.
 
    public JBossResourceException(final String msg)
    {
       super(msg);
    }

   
Construct a JBossResourceException with the specified detail message and error code.

Parameters:
msg Detail message.
code Error code.
 
    public JBossResourceException(final String msgfinal String code)
    {
       super(msgcode);
    }

   
Construct a JBossResourceException with the specified detail message, error code and linked Exception.

Parameters:
msg Detail message.
code Error code.
linked Linked Exception.
 
    @SuppressWarnings("deprecation")
    public JBossResourceException(final String msgfinal String codefinal Throwable linked)
    {
       super(msgcode);
       setLinkedException(process(linked));
   }

   
Construct a JBossResourceException with the specified detail message and linked Exception.

Parameters:
msg Detail message.
linked Linked Exception.
   @SuppressWarnings("deprecation")
   public JBossResourceException(final String msgfinal Throwable linked)
   {
      super(msg);
      setLinkedException(process(linked));
   }

   
Construct a JBossResourceException with the specified linked Exception.

Parameters:
linked Linked Exception.
   public JBossResourceException(final Throwable linked)
   {
      this(linked.getMessage(), linked);
   }

   
Return the nested Throwable.

Returns:
Nested Throwable.
   public Throwable getNested()
   {
      return getLinkedException();
   }

   
Return the nested Throwable.

For JDK 1.4 compatibility.

Returns:
Nested Throwable.
   public Throwable getCause()
   {
      return getLinkedException();
   }

   
Returns the composite throwable message.

Returns:
The composite throwable message.
   public String getMessage()
   {
      return NestedThrowable.Util.getMessage(super.getMessage(), getLinkedException());
   }

   
Prints the composite message and the embedded stack trace to the specified print stream.

Parameters:
stream Stream to print to.
   public void printStackTrace(final PrintStream stream)
   {
      Exception linked = getLinkedException();
      if (linked == null || .)
      {
         super.printStackTrace(stream);
      }
      NestedThrowable.Util.print(linkedstream);
   }

   
Prints the composite message and the embedded stack trace to the specified print writer.

Parameters:
writer Writer to print to.
   public void printStackTrace(final PrintWriter writer)
   {
      Exception linked = getLinkedException();
      if (linked == null || .)
      {
         super.printStackTrace(writer);
      }
      NestedThrowable.Util.print(linkedwriter);
   }

   
Prints the composite message and the embedded stack trace to System.err.
   public void printStackTrace()
   {
   }
   private Exception process(Throwable t)
   {
      if (t instanceof Exception)
      {
         return (Exception)t;
      } // end of if ()
      return new UndeclaredThrowableException(t);
   }
New to GrepCode? Check out our FAQ X