KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdo > tools > enhancer > VerifyException


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.jdo.tools.enhancer;
13
14 import java.util.*;
15
16 import java.lang.reflect.*;
17 import java.io.*;
18
19 /**
20  * An verification error.
21  * @keep-all
22  */

23 public class VerifyException extends Exception JavaDoc {
24
25     private Throwable JavaDoc exception;
26
27     /**
28      * Create new for msg and chained exception.
29      */

30     public VerifyException(String JavaDoc msg, Throwable JavaDoc exception) {
31         super(msg);
32         this.exception = exception;
33     }
34
35     /**
36      * Create new for msg.
37      */

38     public VerifyException(String JavaDoc msg) {
39         this(msg, null);
40     }
41
42     /**
43      * Create new for chained exception.
44      */

45     public VerifyException(Throwable JavaDoc exception) {
46         this(exception.getMessage(), exception);
47     }
48
49     /**
50      * Get the chained (wrapped) exception or null if none.
51      */

52     public Throwable JavaDoc getException() { return exception; }
53
54     /**
55      * Print our stack trace and that of the chained exception (if any).
56      */

57     public void printStackTrace(PrintStream s) {
58         super.printStackTrace(s);
59         if (exception != null) {
60             s.println("Chained exception:");
61             exception.printStackTrace(s);
62         }
63     }
64
65     /**
66      * Print our stack trace and that of the chained exception (if any).
67      */

68     public void printStackTrace(PrintWriter s) {
69         super.printStackTrace(s);
70         if (exception != null) {
71             s.println("Chained exception:");
72             exception.printStackTrace(s);
73         }
74     }
75
76 }
77
Popular Tags