KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > svggen > SVGGraphics2DRuntimeException


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

18 package org.apache.batik.svggen;
19
20 /**
21  * Thrown when an SVG Generator method receives an illegal argument in parameter.
22  *
23  * @author <a HREF="mailto:cjolif@ilog.fr">Christophe Jolif</a>
24  * @version $Id: SVGGraphics2DRuntimeException.java,v 1.3 2004/08/18 07:15:07 vhardy Exp $
25  */

26 public class SVGGraphics2DRuntimeException extends RuntimeException JavaDoc {
27     /** The enclosed exception. */
28     private Exception JavaDoc embedded;
29
30     /**
31      * Constructs a new <code>SVGGraphics2DRuntimeException</code> with the
32      * specified detail message.
33      * @param s the detail message of this exception
34      */

35     public SVGGraphics2DRuntimeException(String JavaDoc s) {
36         this(s, null);
37     }
38
39     /**
40      * Constructs a new <code>SVGGraphics2DRuntimeException</code> with the
41      * specified detail message.
42      * @param ex the enclosed exception
43      */

44     public SVGGraphics2DRuntimeException(Exception JavaDoc ex) {
45         this(null, ex);
46     }
47
48     /**
49      * Constructs a new <code>SVGGraphics2DRuntimeException</code> with the
50      * specified detail message.
51      * @param s the detail message of this exception
52      * @param ex the original exception
53      */

54     public SVGGraphics2DRuntimeException(String JavaDoc s, Exception JavaDoc ex) {
55         super(s);
56         embedded = ex;
57     }
58
59     /**
60      * Returns the message of this exception. If an error message has
61      * been specified, returns that one. Otherwise, return the error message
62      * of enclosed exception or null if any.
63      */

64     public String JavaDoc getMessage() {
65         String JavaDoc msg = super.getMessage();
66         if (msg != null) {
67             return msg;
68         } else if (embedded != null) {
69             return embedded.getMessage();
70         } else {
71             return null;
72         }
73     }
74
75     /**
76      * Returns the original enclosed exception or null if any.
77      */

78     public Exception JavaDoc getException() {
79         return embedded;
80     }
81 }
82
Popular Tags