KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > mdr > persistence > StorageIOException


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.mdr.persistence;
20
21 import java.io.*;
22
23 /**
24 * This is thrown when an IO error occurs in the storage layer. The IOException
25 * is converted to a subclass of Storage Exception to maintain this simple
26 * rule: only StorageExceptions are thrown from the storage layer. A
27 * StorageIOException returns the stack trace information of the
28 * original IOException occurred, since this is far more useful than the stack
29 * trace of the point where the exception was converted.
30 */

31
32 public class StorageIOException extends StorageException {
33
34     /** The original IO Exception that we are converting to a StorageException
35     */

36     private IOException ioExcept;
37
38     /** this constructs a StorageIOException from an IOException
39     * @param err the IOException
40     */

41     public StorageIOException(IOException err) {
42     super(err.getMessage());
43     ioExcept = err;
44     }
45
46     /** return the original IOException's message */
47     public String JavaDoc getMessage() {
48     return ioExcept.getMessage();
49     }
50     
51     /** return the original IOException's localized message */
52     public String JavaDoc getLocalizedMessage() {
53     return ioExcept.getLocalizedMessage();
54     }
55
56     /** print the original IOException's stack trace */
57     public void printStackTrace() {
58     ioExcept.printStackTrace();
59     }
60
61     /** print the original IOException's stack trace */
62     public void printStackTrace(PrintStream ps) {
63     ioExcept.printStackTrace(ps);
64     }
65
66     /** print the original IOException's stack trace */
67     public void printStackTrace(PrintWriter pw) {
68     ioExcept.printStackTrace(pw);
69     }
70     
71 }
72
Popular Tags