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 468654 2006-10-28 07:09:23Z minchau $ 20 */ 21package org.apache.xml.serializer.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 * This class is a copy of the one in org.apache.xml.utils. 29 * It exists to cut the serializers dependancy on that package. 30 * 31 * This class is not a public API, it is only public because it is 32 * used by org.apache.xml.serializer. 33 * @xsl.usage internal 34 */ 35public final class WrappedRuntimeException extends RuntimeException 36{ 37 static final long serialVersionUID = 7140414456714658073L; 38 39 /** Primary checked exception. 40 * @serial */ 41 private Exception m_exception; 42 43 /** 44 * Construct a WrappedRuntimeException from a 45 * checked exception. 46 * 47 * @param e Primary checked exception 48 */ 49 public WrappedRuntimeException(Exception e) 50 { 51 52 super(e.getMessage()); 53 54 m_exception = e; 55 } 56 57 /** 58 * Constructor WrappedRuntimeException 59 * 60 * 61 * @param msg Exception information. 62 * @param e Primary checked exception 63 */ 64 public WrappedRuntimeException(String msg, Exception e) 65 { 66 67 super(msg); 68 69 m_exception = e; 70 } 71 72 /** 73 * Get the checked exception that this runtime exception wraps. 74 * 75 * @return The primary checked exception 76 */ 77 public Exception getException() 78 { 79 return m_exception; 80 } 81} 82