Home | History | Annotate | Download | only in utils
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one
      3  * or more contributor license agreements. See the NOTICE file
      4  * distributed with this work for additional information
      5  * regarding copyright ownership. The ASF licenses this file
      6  * to you under the Apache License, Version 2.0 (the  "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *     http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  */
     18 /*
     19  * $Id: WrappedRuntimeException.java 468655 2006-10-28 07:12:06Z minchau $
     20  */
     21 package org.apache.xml.utils;
     22 
     23 /**
     24  * This class is for throwing important checked exceptions
     25  * over non-checked methods.  It should be used with care,
     26  * and in limited circumstances.
     27  */
     28 public class WrappedRuntimeException extends RuntimeException
     29 {
     30     static final long serialVersionUID = 7140414456714658073L;
     31 
     32   /** Primary checked exception.
     33    *  @serial          */
     34   private Exception m_exception;
     35 
     36   /**
     37    * Construct a WrappedRuntimeException from a
     38    * checked exception.
     39    *
     40    * @param e Primary checked exception
     41    */
     42   public WrappedRuntimeException(Exception e)
     43   {
     44 
     45     super(e.getMessage());
     46 
     47     m_exception = e;
     48   }
     49 
     50   /**
     51    * Constructor WrappedRuntimeException
     52    *
     53    *
     54    * @param msg Exception information.
     55    * @param e Primary checked exception
     56    */
     57   public WrappedRuntimeException(String msg, Exception e)
     58   {
     59 
     60     super(msg);
     61 
     62     m_exception = e;
     63   }
     64 
     65   /**
     66    * Get the checked exception that this runtime exception wraps.
     67    *
     68    * @return The primary checked exception
     69    */
     70   public Exception getException()
     71   {
     72     return m_exception;
     73   }
     74 }
     75