KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > dyade > aaa > agent > AgentException


1 /*
2  * Copyright (C) 1996 - 2000 BULL
3  * Copyright (C) 1996 - 2000 INRIA
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  */

20 package fr.dyade.aaa.agent;
21
22 /**
23  * Thrown by the <code>Agentfactory</code> when an error is
24  * raised during the initialization.
25  */

26 public class AgentException extends Exception JavaDoc {
27
28   /**
29    * This class does not use the <code>initCause</code>
30    * because this class handles the deserialization
31    * of the cause that may fail if its class is
32    * unknown.
33    */

34   private Throwable JavaDoc cause;
35
36   public AgentException(Throwable JavaDoc cause) {
37     super(cause.toString());
38     this.cause = cause;
39   }
40
41   /**
42    * Overrides the <code>Throwable</code> behavior
43    * in order to handle the deserialization
44    * of the cause that may fail if its class
45    * is unknown.
46    *
47    * @return the cause or <code>null</code> if
48    * its class is unknown.
49    */

50   public final Throwable JavaDoc getCause() {
51     return cause;
52   }
53
54   private void writeObject(java.io.ObjectOutputStream JavaDoc out)
55     throws java.io.IOException JavaDoc {
56     out.writeObject(cause);
57   }
58
59   private void readObject(java.io.ObjectInputStream JavaDoc in)
60     throws java.io.IOException JavaDoc, ClassNotFoundException JavaDoc {
61     try {
62       this.cause = (Throwable JavaDoc)in.readObject();
63     } catch (ClassNotFoundException JavaDoc exc) {
64       // Do nothing
65
}
66   }
67
68 }
69
Popular Tags