KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.io.IOException JavaDoc;
21
22 /**
23  * Thrown when an SVG Generator method receives an illegal argument in parameter.
24  *
25  * @author <a HREF="mailto:cjolif@ilog.fr">Christophe Jolif</a>
26  * @version $Id: SVGGraphics2DIOException.java,v 1.5 2004/08/18 07:15:07 vhardy Exp $
27  */

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

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

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

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

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

80     public IOException JavaDoc getException() {
81         return embedded;
82     }
83 }
84
Popular Tags