01: /*
02:
03: Licensed to the Apache Software Foundation (ASF) under one or more
04: contributor license agreements. See the NOTICE file distributed with
05: this work for additional information regarding copyright ownership.
06: The ASF licenses this file to You under the Apache License, Version 2.0
07: (the "License"); you may not use this file except in compliance with
08: the License. You may obtain a copy of the License at
09:
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: package org.apache.batik.svggen;
20:
21: import java.io.IOException;
22:
23: /**
24: * Thrown when an SVG Generator method receives an illegal argument in parameter.
25: *
26: * @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
27: * @version $Id: SVGGraphics2DIOException.java 475477 2006-11-15 22:44:28Z cam $
28: */
29: public class SVGGraphics2DIOException extends IOException {
30: /** The enclosed exception. */
31: private IOException embedded;
32:
33: /**
34: * Constructs a new <code>SVGGraphics2DIOException</code> with the
35: * specified detail message.
36: * @param s the detail message of this exception
37: */
38: public SVGGraphics2DIOException(String s) {
39: this (s, null);
40: }
41:
42: /**
43: * Constructs a new <code>SVGGraphics2DIOException</code> with the
44: * specified detail message.
45: * @param ex the enclosed exception
46: */
47: public SVGGraphics2DIOException(IOException ex) {
48: this (null, ex);
49: }
50:
51: /**
52: * Constructs a new <code>SVGGraphics2DIOException</code> with the
53: * specified detail message.
54: * @param s the detail message of this exception
55: * @param ex the original exception
56: */
57: public SVGGraphics2DIOException(String s, IOException ex) {
58: super (s);
59: embedded = ex;
60: }
61:
62: /**
63: * Returns the message of this exception. If an error message has
64: * been specified, returns that one. Otherwise, return the error message
65: * of enclosed exception or null if any.
66: */
67: public String getMessage() {
68: String msg = super .getMessage();
69: if (msg != null) {
70: return msg;
71: } else if (embedded != null) {
72: return embedded.getMessage();
73: } else {
74: return null;
75: }
76: }
77:
78: /**
79: * Returns the original enclosed exception or null if any.
80: */
81: public IOException getException() {
82: return embedded;
83: }
84: }
|