001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements. See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership. The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the  "License");
007     * you may not use this file except in compliance with the License.
008     * You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    /*
019     * $Id: WrappedRuntimeException.java 468654 2006-10-28 07:09:23Z minchau $
020     */
021    package org.apache.xml.serializer.utils;
022    
023    /**
024     * This class is for throwing important checked exceptions
025     * over non-checked methods.  It should be used with care,
026     * and in limited circumstances.
027     * 
028     * This class is a copy of the one in org.apache.xml.utils. 
029     * It exists to cut the serializers dependancy on that package.
030     * 
031     * This class is not a public API, it is only public because it is
032     * used by org.apache.xml.serializer.
033     * @xsl.usage internal
034     */
035    public final class WrappedRuntimeException extends RuntimeException
036    {
037        static final long serialVersionUID = 7140414456714658073L;
038    
039      /** Primary checked exception.
040       *  @serial          */
041      private Exception m_exception;
042    
043      /**
044       * Construct a WrappedRuntimeException from a
045       * checked exception.
046       *
047       * @param e Primary checked exception
048       */
049      public WrappedRuntimeException(Exception e)
050      {
051    
052        super(e.getMessage());
053    
054        m_exception = e;
055      }
056    
057      /**
058       * Constructor WrappedRuntimeException
059       *
060       *
061       * @param msg Exception information.
062       * @param e Primary checked exception
063       */
064      public WrappedRuntimeException(String msg, Exception e)
065      {
066    
067        super(msg);
068    
069        m_exception = e;
070      }
071      
072      /**
073       * Get the checked exception that this runtime exception wraps.
074       *
075       * @return The primary checked exception
076       */
077      public Exception getException()
078      {
079        return m_exception;
080      }
081    }