KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > common > codegen > CodeGenException


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  * Paul Mahar
21  *
22  */

23 package org.enhydra.kelp.common.codegen;
24
25 // Kelp imports
26
import org.enhydra.kelp.common.Constants;
27 //
28
import java.io.PrintStream JavaDoc;
29
30 /**
31  * The WebAppException is thrown for exceptions in the
32  * WebAppUtil class.
33  */

34 public class CodeGenException extends Exception JavaDoc {
35     private Throwable JavaDoc parent = null;
36     private boolean decoy = false;
37
38     /**
39      * Create a GeneratorException with a specified error message.
40      *
41      * @param message
42      * Message providing information on the nature of the exception.
43      */

44     public CodeGenException(String JavaDoc message) {
45         super(message);
46     }
47
48     /**
49      * Constructor declaration
50      *
51      *
52      * @param hidden
53      *
54      * @see
55      */

56     public CodeGenException(Throwable JavaDoc hidden) {
57         super(new String JavaDoc());
58         parent = hidden.fillInStackTrace();
59         decoy = true;
60     }
61
62     /**
63      * Constructor declaration
64      *
65      *
66      * @param chain
67      * @param message
68      *
69      * @see
70      */

71     public CodeGenException(Throwable JavaDoc chain, String JavaDoc message) {
72         super(message);
73         parent = chain.fillInStackTrace();
74     }
75
76     /**
77      * Method declaration
78      *
79      *
80      * @return
81      *
82      * @see
83      */

84     public String JavaDoc getMessage() {
85         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
86
87         if ((!decoy) || (parent == null)) {
88             buf.append(super.getMessage());
89         }
90         if (parent != null) {
91             buf.append('\n');
92             buf.append(Constants.TAB4);
93             buf.append(parent.getMessage());
94         }
95         return buf.toString();
96     }
97
98     public void printStackTrace() {
99         super.printStackTrace();
100         if (parent != null) {
101             parent.printStackTrace();
102         }
103     }
104
105     public void printStackTrace(PrintStream JavaDoc stream) {
106         super.printStackTrace(stream);
107         if (parent != null) {
108             parent.printStackTrace(stream);
109         }
110     }
111
112
113
114 }
115
Popular Tags