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 468655 2006-10-28 07:12:06Z minchau $
020     */
021    package org.apache.xml.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    public class WrappedRuntimeException extends RuntimeException
029    {
030        static final long serialVersionUID = 7140414456714658073L;
031    
032      /** Primary checked exception.
033       *  @serial          */
034      private Exception m_exception;
035    
036      /**
037       * Construct a WrappedRuntimeException from a
038       * checked exception.
039       *
040       * @param e Primary checked exception
041       */
042      public WrappedRuntimeException(Exception e)
043      {
044    
045        super(e.getMessage());
046    
047        m_exception = e;
048      }
049    
050      /**
051       * Constructor WrappedRuntimeException
052       *
053       *
054       * @param msg Exception information.
055       * @param e Primary checked exception
056       */
057      public WrappedRuntimeException(String msg, Exception e)
058      {
059    
060        super(msg);
061    
062        m_exception = e;
063      }
064      
065      /**
066       * Get the checked exception that this runtime exception wraps.
067       *
068       * @return The primary checked exception
069       */
070      public Exception getException()
071      {
072        return m_exception;
073      }
074    }