01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: 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.poi.hpsf;
19:
20: /**
21: * <p>This exception is the superclass of all other checked exceptions thrown
22: * in this package. It supports a nested "reason" throwable, i.e. an exception
23: * that caused this one to be thrown.</p>
24: *
25: * @author Rainer Klute <a
26: * href="mailto:klute@rainer-klute.de"><klute@rainer-klute.de></a>
27: * @version $Id: HPSFException.java 489730 2006-12-22 19:18:16Z bayard $
28: * @since 2002-02-09
29: */
30: public class HPSFException extends Exception {
31:
32: /**
33: * <p>The underlying reason for this exception - may be
34: * <code>null</code>.</p>
35: * */
36: private Throwable reason;
37:
38: /**
39: * <p>Creates an {@link HPSFException}.</p>
40: */
41: public HPSFException() {
42: super ();
43: }
44:
45: /**
46: * <p>Creates an {@link HPSFException} with a message string.</p>
47: *
48: * @param msg The message string.
49: */
50: public HPSFException(final String msg) {
51: super (msg);
52: }
53:
54: /**
55: * <p>Creates a new {@link HPSFException} with a reason.</p>
56: *
57: * @param reason The reason, i.e. a throwable that indirectly
58: * caused this exception.
59: */
60: public HPSFException(final Throwable reason) {
61: super ();
62: this .reason = reason;
63: }
64:
65: /**
66: * <p>Creates an {@link HPSFException} with a message string and a
67: * reason.</p>
68: *
69: * @param msg The message string.
70: * @param reason The reason, i.e. a throwable that indirectly
71: * caused this exception.
72: */
73: public HPSFException(final String msg, final Throwable reason) {
74: super (msg);
75: this .reason = reason;
76: }
77:
78: /**
79: * <p>Returns the {@link Throwable} that caused this exception to
80: * be thrown or <code>null</code> if there was no such {@link
81: * Throwable}.</p>
82: *
83: * @return The reason
84: */
85: public Throwable getReason() {
86: return reason;
87: }
88:
89: }
|