KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > serializer > utils > WrappedRuntimeException


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: WrappedRuntimeException.java,v 1.1.4.1 2005/09/08 11:03:21 suresh_emailid Exp $
18  */

19 package com.sun.org.apache.xml.internal.serializer.utils;
20
21 /**
22  * This class is for throwing important checked exceptions
23  * over non-checked methods. It should be used with care,
24  * and in limited circumstances.
25  *
26  * This class is a copy of the one in com.sun.org.apache.xml.internal.utils.
27  * It exists to cut the serializers dependancy on that package.
28  *
29  * This class is not a public API, it is only public because it is
30  * used by com.sun.org.apache.xml.internal.serializer.
31  * @xsl.usage internal
32  */

33 public final class WrappedRuntimeException extends RuntimeException JavaDoc
34 {
35     static final long serialVersionUID = 7140414456714658073L;
36
37   /** Primary checked exception.
38    * @serial */

39   private Exception JavaDoc m_exception;
40
41   /**
42    * Construct a WrappedRuntimeException from a
43    * checked exception.
44    *
45    * @param e Primary checked exception
46    */

47   public WrappedRuntimeException(Exception JavaDoc e)
48   {
49
50     super(e.getMessage());
51
52     m_exception = e;
53   }
54
55   /**
56    * Constructor WrappedRuntimeException
57    *
58    *
59    * @param msg Exception information.
60    * @param e Primary checked exception
61    */

62   public WrappedRuntimeException(String JavaDoc msg, Exception JavaDoc e)
63   {
64
65     super(msg);
66
67     m_exception = e;
68   }
69   
70   /**
71    * Get the checked exception that this runtime exception wraps.
72    *
73    * @return The primary checked exception
74    */

75   public Exception JavaDoc getException()
76   {
77     return m_exception;
78   }
79 }
80
Popular Tags