Save This Page
Home » mq4_2-source-20080707.jar » javax » jms » [javadoc | source]
    1   /*
    2    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    3    *
    4    * Copyright 2000-2007 Sun Microsystems, Inc. All rights reserved. 
    5    *
    6    * The contents of this file are subject to the terms of either the GNU
    7    * General Public License Version 2 only ("GPL") or the Common Development
    8    * and Distribution License ("CDDL") (collectively, the "License").  You may
    9    * not use this file except in compliance with the License.  You can obtain
   10    * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
   11    * or mq/legal/LICENSE.txt.  See the License for the specific language
   12    * governing permissions and limitations under the License.
   13    * 
   14    * When distributing the software, include this License Header Notice in each
   15    * file and include the License file at mq/legal/LICENSE.txt.  Sun designates
   16    * this particular file as subject to the "Classpath" exception as provided by
   17    * Sun in the GPL Version 2 section of the License file that accompanied this
   18    * code.  If applicable, add the following below the License Header, with the
   19    * fields enclosed by brackets [] replaced by your own identifying information:
   20    * "Portions Copyrighted [year] [name of copyright owner]"
   21    * 
   22    * Contributor(s):
   23    * 
   24    * If you wish your version of this file to be governed by only the CDDL or
   25    * only the GPL Version 2, indicate your decision by adding "[Contributor]
   26    * elects to include this software in this distribution under the [CDDL or GPL
   27    * Version 2] license."  If you don't indicate a single choice of license, a
   28    * recipient has the option to distribute your version of this file under
   29    * either the CDDL, the GPL Version 2 or  to extend the choice of license to
   30    * its licensees as provided above.  However, if you add GPL Version 2 code
   31    * and therefore, elected the GPL Version 2 license, then the option applies
   32    * only if the new code is made subject to such option by the copyright holder. 
   33    */
   34   
   35   /*
   36    * @(#)JMSException.java	1.17 07/02/07
   37    */ 
   38   
   39   package javax.jms;
   40   
   41   /**
   42    * <P>This is the root class of all JMS API exceptions.
   43    *
   44    * <P>It provides the following information:
   45    * <UL>
   46    *   <LI> A provider-specific string describing the error. This string is 
   47    *        the standard exception message and is available via the
   48    *        <CODE>getMessage</CODE> method.
   49    *   <LI> A provider-specific string error code 
   50    *   <LI> A reference to another exception. Often a JMS API exception will 
   51    *        be the result of a lower-level problem. If appropriate, this 
   52    *        lower-level exception can be linked to the JMS API exception.
   53    * </UL>
   54    **/
   55   
   56   public class JMSException extends Exception {
   57   
   58     /** Vendor-specific error code.
   59     **/
   60     private String errorCode;
   61   
   62     /** <CODE>Exception</CODE> reference.
   63     **/
   64     private Exception linkedException;
   65   
   66   
   67     /** Constructs a <CODE>JMSException</CODE> with the specified reason and 
   68      *  error code.
   69      *
   70      *  @param  reason        a description of the exception
   71      *  @param  errorCode     a string specifying the vendor-specific
   72      *                        error code
   73      **/
   74     public 
   75     JMSException(String reason, String errorCode) {
   76       super(reason);
   77       this.errorCode = errorCode;
   78       linkedException = null;
   79     }
   80   
   81     /** Constructs a <CODE>JMSException</CODE> with the specified reason and with
   82      *  the error code defaulting to null.
   83      *
   84      *  @param  reason        a description of the exception
   85      **/
   86     public 
   87     JMSException(String reason) {
   88       super(reason);
   89       this.errorCode = null;
   90       linkedException = null;
   91     }
   92   
   93     /** Gets the vendor-specific error code.
   94      *  @return   a string specifying the vendor-specific
   95      *                        error code
   96     **/
   97     public 
   98     String getErrorCode() {
   99       return this.errorCode;
  100     }
  101   
  102     /**
  103      * Gets the exception linked to this one.
  104      *
  105      * @return the linked <CODE>Exception</CODE>, null if none
  106     **/
  107     public 
  108     Exception getLinkedException() {
  109       return (linkedException);
  110     }
  111   
  112     /**
  113      * Adds a linked <CODE>Exception</CODE>.
  114      *
  115      * @param ex       the linked <CODE>Exception</CODE>
  116     **/
  117     public 
  118     synchronized void setLinkedException(Exception ex) {
  119         linkedException = ex;
  120     }
  121   }

Save This Page
Home » mq4_2-source-20080707.jar » javax » jms » [javadoc | source]