Skip to main content
summaryrefslogtreecommitdiffstats
blob: 768f34b33f4272bbeff7c2300c5b399e6b114b81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*******************************************************************************
 * Copyright (c) 2001, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.j2ee.internal;



/**
 * Base exception class for non-runtime exceptions, where a caught exception
 * causes this exception to be thrown
 */
public abstract class WrappedException extends Exception implements IWrappedException {
	/**
	 * 
	 */
	private static final long serialVersionUID = 2477488574387544467L;
	/** The exception which necessitated this exception */
	protected Exception nestedException;

public WrappedException() {
	super();
}
public WrappedException(Exception e) {
	super();
	setNestedException(e);
}
public WrappedException(String s) {
	super(s);
}
public WrappedException(String s, Exception e) {
	super(s);
	setNestedException(e);
}
/**
 * Return the messages from this and all nested exceptions, in order from outermost to innermost
 */
public java.lang.String[] getAllMessages() {
	return ExceptionHelper.getAllMessages(this);
}
/**
 * Return the messages from this and all nested exceptions, in order from outermost to innermost,
 * concatenated as one
 */
public java.lang.String getConcatenatedMessages() {
	return ExceptionHelper.getConcatenatedMessages(this);
}
public java.lang.Exception getNestedException() {
	return nestedException;
}
/**
 * Added to provide compatibility for the Java 1.4.2 addition of
 * <code>Throwable.getCause()</code>.
 */
@Override
public java.lang.Throwable getCause() {
	return getNestedException();
}
/**
 * Print out a stack trace to the system err.
 */
@Override
public void printStackTrace() {
	printStackTrace(System.err);
}
/**
* Prints the exception to System.err.
* If we have a nested exception, print its stack.
*/
@Override
public void printStackTrace(java.io.PrintStream s) {
	if (nestedException != null) {
		s.println(this);
		s.println(MOFJ2EEResourceHandler.Stack_trace_of_nested_exce); // = "Stack trace of nested exception:"
		nestedException.printStackTrace(s);
	} else {
		super.printStackTrace(s);
	}
}
/**
* Prints the exception to System.err.
* If we have a nested exception, print its stack.
*/
@Override
public void printStackTrace(java.io.PrintWriter s) {
	if (nestedException != null) {
		s.println(this);
		s.println(MOFJ2EEResourceHandler.Stack_trace_of_nested_exce); // = "Stack trace of nested exception:"
		nestedException.printStackTrace(s);
	} else {
		super.printStackTrace(s);
	}
}
public void setNestedException(java.lang.Exception newNestedException) {
	nestedException = newNestedException;
    initCause(newNestedException);
}
}


Back to the top