OSDN Git Service

* All files: Updated copyright information.
[pf3gnuchains/gcc-fork.git] / libjava / java / lang / reflect / InvocationTargetException.java
1 // InvocationTargetException.java - Wrapper exception for reflection.
2
3 /* Copyright (C) 1998, 1999  Free Software Foundation
4
5    This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10  
11 package java.lang.reflect;
12 import java.io.PrintStream;
13 import java.io.PrintWriter;
14
15 /**
16  * @author Tom Tromey <tromey@cygnus.com>
17  * @date December 12, 1998
18  */
19 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
20  * "The Java Language Specification", ISBN 0-201-63451-1
21  * Status:  Believed complete and correct.
22  */
23
24 public class InvocationTargetException extends Exception
25 {
26   public Throwable getTargetException ()
27     {
28       return target;
29     }
30
31   protected InvocationTargetException ()
32     {
33       super ();
34       target = null;
35     }
36
37   public InvocationTargetException (Throwable exception)
38     {
39       super ();
40       target = exception;
41     }
42
43   public InvocationTargetException (Throwable exception, String msg)
44     {
45       super (msg);
46       target = exception;
47     }
48
49   // This is from JDK 1.2.
50   public void printStackTrace ()
51     {
52       if (target != null)
53         target.printStackTrace();
54     }
55
56   // This is from JDK 1.2.
57   public void printStackTrace (PrintStream s)
58     {
59       if (target != null)
60         target.printStackTrace(s);
61     }
62
63   // This is from JDK 1.2.
64   public void printStackTrace (PrintWriter wr)
65     {
66       if (target != null)
67         target.printStackTrace(wr);
68     }
69
70   // The wrapped exception.  The name is specified by the
71   // serialization spec.
72   private Throwable target;
73 }