01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.core;
18:
19: import java.io.IOException;
20:
21: /**
22: * Subclass of IOException that properly handles a root cause,
23: * exposing the root cause just like NestedChecked/RuntimeException does.
24: *
25: * <p>The similarity between this class and the NestedChecked/RuntimeException
26: * class is unavoidable, as this class needs to derive from IOException
27: * and cannot derive from NestedCheckedException.
28: *
29: * @author Juergen Hoeller
30: * @since 2.0
31: * @see #getMessage
32: * @see #printStackTrace
33: * @see org.springframework.core.NestedCheckedException
34: * @see org.springframework.core.NestedRuntimeException
35: */
36: public class NestedIOException extends IOException {
37:
38: /**
39: * Construct a <code>NestedIOException</code> with the specified detail message.
40: * @param msg the detail message
41: */
42: public NestedIOException(String msg) {
43: super (msg);
44: }
45:
46: /**
47: * Construct a <code>NestedIOException</code> with the specified detail message
48: * and nested exception.
49: * @param msg the detail message
50: * @param cause the nested exception
51: */
52: public NestedIOException(String msg, Throwable cause) {
53: super (msg);
54: initCause(cause);
55: }
56:
57: /**
58: * Return the detail message, including the message from the nested exception
59: * if there is one.
60: */
61: public String getMessage() {
62: return NestedExceptionUtils.buildMessage(super.getMessage(),
63: getCause());
64: }
65:
66: }
|