001    /**
002     *
003     * Copyright 2003-2004 The Apache Software Foundation
004     *
005     *  Licensed under the Apache License, Version 2.0 (the "License");
006     *  you may not use this file except in compliance with the License.
007     *  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    //
019    // This source code implements specifications defined by the Java
020    // Community Process. In order to remain compliant with the specification
021    // DO NOT add / change / or delete method signatures!
022    //
023    
024    package javax.resource;
025    
026    /**
027     *
028     *
029     *
030     * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
031     */
032    public class ResourceException extends Exception {
033        private String errorCode;
034        private Exception linkedException;
035    
036        public ResourceException() {
037            super();
038        }
039    
040        public ResourceException(String message) {
041            super(message);
042        }
043    
044        public ResourceException(Throwable cause) {
045            super(cause);
046        }
047    
048        public ResourceException(String message, Throwable cause) {
049            super(message, cause);
050        }
051    
052        public ResourceException(String message, String errorCode) {
053            super(message);
054            setErrorCode(errorCode);
055        }
056    
057        public String getErrorCode() {
058            return errorCode;
059        }
060    
061        public void setErrorCode(String errorCode) {
062            this.errorCode = errorCode;
063        }
064    
065        /**
066         * @deprecated
067         */
068        public Exception getLinkedException() {
069            return linkedException;
070        }
071    
072        /**
073         * @deprecated
074         */
075        public void setLinkedException(Exception ex) {
076            // unit tests revealed that Throwable.initCause is not invoked
077            this.linkedException = ex;
078        }
079    
080        public String toString() {
081            // unit tests revealed that the errorCode is not included
082            return getMessage();
083        }
084    }