View Javadoc
1 // re/mind - Remote Reminder Software 2 // Copyright (C) 2002 Moritz Petersen 3 // 4 // This program is free software; you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation; either version 2 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program; if not, write to the Free Software 16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 // 18 // $Id: StorageException.java,v 1.1.1.1 2002/09/29 17:26:04 powerpete Exp $ 19 package de.jface.remind.io; 20 21 import java.io.PrintStream; 22 import java.io.PrintWriter; 23 24 /*** 25 * Exception <code>StorageException</code> 26 * of project RemotePostIt. 27 * 28 * @author Moritz Petersen 29 * @version $Revision: 1.1.1.1 $ 30 */ 31 public class StorageException 32 extends Exception 33 { 34 /*** 35 * The root exception, that lead to the StorageException. 36 */ 37 private Exception rootException; 38 39 /*** 40 * Creates an empty StorageException. 41 */ 42 public StorageException() 43 { 44 super(); 45 } 46 47 /*** 48 * Creeates a StorageException containing a message. 49 * 50 * @param message the message of the StorageException. 51 */ 52 public StorageException(String message) 53 { 54 super(message); 55 } 56 57 /*** 58 * Creates a StorageException containing a message and a 59 * root exception. 60 * 61 * @param message the message of the StorageException. 62 * @param rootException the exception that lead to the StorageException. 63 */ 64 public StorageException(String message, Exception rootException) 65 { 66 super(message); 67 this.rootException = rootException; 68 } 69 70 /*** 71 * Creates a StorageException containing a root exception. 72 * 73 * @param rootException the exception that lead to the StorageException. 74 */ 75 public StorageException(Exception rootException) 76 { 77 super(rootException.getMessage()); 78 this.rootException = rootException; 79 } 80 81 /*** 82 * Returns the root exception of the StorageException. 83 * 84 * @return The root exception. 85 */ 86 public Exception getRootException() 87 { 88 return rootException; 89 } 90 91 /*** 92 * Prints a stack trace to the standard error stream. 93 */ 94 public void printStackTrace() 95 { 96 this.printStackTrace(System.err); 97 } 98 99 /*** 100 * Prints a stack trace to the specified writer. 101 * 102 * @param writer the PrintWriter the stack trace is printed to. 103 */ 104 public void printStackTrace(PrintWriter writer) 105 { 106 super.printStackTrace(writer); 107 108 if (rootException != null) 109 { 110 writer.println("root exception is:"); 111 rootException.printStackTrace(writer); 112 } 113 } 114 115 /*** 116 * Prints a stack trace to the specified PrintStream. 117 * 118 * @param stream the OutputStream the stack trace is printed to. 119 */ 120 public void printStackTrace(PrintStream stream) 121 { 122 this.printStackTrace(new PrintWriter(stream)); 123 } 124 }

This page was automatically generated by Maven