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.hssf.eventusermodel;
19:
20: /**
21: * <p>This exception is provided as a way for API users to throw
22: * exceptions from their event handling code. By doing so they
23: * abort file processing by the HSSFEventFactory and by
24: * catching it from outside the HSSFEventFactory.processEvents
25: * method they can diagnose the cause for the abort.</p>
26: *
27: * <p>The HSSFUserException supports a nested "reason"
28: * throwable, i.e. an exception that caused this one to be thrown.</p>
29: *
30: * <p>The HSSF package does not itself throw any of these
31: * exceptions.</p>
32: *
33: * @author Rainer Klute (klute@rainer-klute.de)
34: * @author Carey Sublette (careysub@earthling.net)
35: * @version HSSFUserException.java,v 1.0
36: * @since 2002-04-19
37: */
38: public class HSSFUserException extends Exception {
39:
40: private Throwable reason;
41:
42: /**
43: * <p>Creates a new {@link HSSFUserException}.</p>
44: */
45: public HSSFUserException() {
46: super ();
47: }
48:
49: /**
50: * <p>Creates a new {@link HSSFUserException} with a message
51: * string.</p>
52: */
53: public HSSFUserException(final String msg) {
54: super (msg);
55: }
56:
57: /**
58: * <p>Creates a new {@link HSSFUserException} with a reason.</p>
59: */
60: public HSSFUserException(final Throwable reason) {
61: super ();
62: this .reason = reason;
63: }
64:
65: /**
66: * <p>Creates a new {@link HSSFUserException} with a message string
67: * and a reason.</p>
68: */
69: public HSSFUserException(final String msg, final Throwable reason) {
70: super (msg);
71: this .reason = reason;
72: }
73:
74: /**
75: * <p>Returns the {@link Throwable} that caused this exception to
76: * be thrown or <code>null</code> if there was no such {@link
77: * Throwable}.</p>
78: */
79: public Throwable getReason() {
80: return reason;
81: }
82:
83: }
|