KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > core > command > CommandCancelledException


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16
package org.columba.core.command;
17
18 import java.lang.reflect.InvocationTargetException JavaDoc;
19 import java.lang.reflect.Method JavaDoc;
20
21 /**
22  * Throwing this exception in a Command aborts the execution immediately.
23  *
24  * @author Timo Stich (tstich@users.sourceforge.net)
25  */

26 public class CommandCancelledException extends Exception JavaDoc {
27     /**
28          * Serialize version uid which was generated from the compiler.
29          */

30     private static final long serialVersionUID = 7444994996504305731L;
31
32     /**
33          * Constructor for CommandCancelledException.
34          */

35     public CommandCancelledException() {
36     super();
37     }
38
39     /**
40          * Constructor for CommandCancelledException.
41          *
42          * @param message
43          */

44     public CommandCancelledException(String JavaDoc message) {
45     super(message);
46     }
47
48     /**
49          * Constructor for CommandCancelledException.
50          *
51          * @param message
52          * @param cause
53          */

54     public CommandCancelledException(String JavaDoc message, Throwable JavaDoc cause) {
55     this(message);
56     compatibleInitCause(cause);
57     }
58
59     /**
60          * Constructor for CommandCancelledException.
61          *
62          * @param cause
63          */

64     public CommandCancelledException(Throwable JavaDoc cause) {
65     this();
66     compatibleInitCause(cause);
67     }
68
69     private void compatibleInitCause(Throwable JavaDoc cause) {
70     try {
71         Method JavaDoc initCause = getClass().getMethod(
72             "initCause", new Class JavaDoc[] { Throwable JavaDoc.class }); //$NON-NLS-1$
73
initCause.invoke(this, new Object JavaDoc[] { cause });
74     } catch (NoSuchMethodException JavaDoc nsme) {
75         // nothing to do yet
76
} catch (IllegalAccessException JavaDoc iae) {
77         // nothing to do yet
78
} catch (InvocationTargetException JavaDoc ite) {
79         // nothing to do yet
80
}
81     }
82 }
83
Popular Tags