File: java.lang.Throwable

package info (click to toggle)
bock 0.20.2.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,228 kB
  • ctags: 1,370
  • sloc: ansic: 7,367; java: 5,553; yacc: 963; lex: 392; makefile: 243; sh: 90; perl: 42
file content (252 lines) | stat: -rw-r--r-- 8,197 bytes parent folder | download | duplicates (3)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
// java.lang.Throwable -- an implementation of the Java Language Spec sec 20.22
// Written by Charles Briscoe-Smith; refer to the file LEGAL for details.

package java.lang;

import java.io.PrintStream;

class StackFrame {

	String classname;
	String methodname;
	StackFrame previous;

	StackFrame(String c, String m, StackFrame f)
	{
		classname=c;
		methodname=m;
		previous=f;
	}

	void printOn(PrintStream out, boolean top)
	{
		out.print(top ? "   in " : "   called from ");
		out.print(classname);
		out.print('.');
		out.println(methodname);
		if (previous!=null) previous.printOn(out, false);
	}

}

public class Throwable {

	public Throwable() {
		this(null);
	}

	public Throwable(String msg) {
		message=msg;
		fillInStackTrace();
	}

	private String message;
	private StackFrame trace;

	public String getMessage() {
		return message;
	}

	public String toString() {
		String name=getClass().getName();
		if (message==null) return name;

		StringBuffer output=new StringBuffer();
		output.append(name);
		output.append(": ");
		output.append(message);
		return output.toString();
	}

	// stackframe is a "hidden" parameter.	A proper
	// implementation would just put this stuff on the stack.
	private static native String getClassName(Object frame)
		"return ((struct JavaStackFrame *) l_frame)->class;" ;
	private static native String getMethodName(Object frame)
		"return ((struct JavaStackFrame *) l_frame)->method;" ;
	private static native Object getPrevious(Object frame)
		"return (void*) ((struct JavaStackFrame*) l_frame)->previous;" ;

	private static native Object fetchframe()
		"return (void *) stackframe->previous->previous;" ;

	// Despite appearances, this doesn't cause infinite recursion if
	// memory runs out; automatically thrown errors are preallocated
	// and don't record a stack trace at all.
	private static StackFrame toStackTrace(Object frame)
	{
		if (frame==null) return null;
		return new StackFrame(getClassName(frame),
		                      getMethodName(frame),
		                      toStackTrace(getPrevious(frame)));
	}

	public Throwable fillInStackTrace() {
		trace=toStackTrace(fetchframe());
		// FIXME: what should this return?
		return this;
	}

	public void printStackTrace() {
		System.err.println(toString());
		trace.printOn(System.err, true);
	}

}

public class ExceptionInInitializerError extends LinkageError {
	public ExceptionInInitializerError() { }
	public ExceptionInInitializerError(String msg) { super(msg); }
	public ExceptionInInitializerError(Throwable thr) { thrown=thr; }
	public Throwable getException() { return thrown; }
	private Throwable thrown;
}

public class Error extends Throwable {
	public Error() { }
	public Error(String msg) { super(msg); }
}
public class LinkageError extends Error {
	public LinkageError() { }
	public LinkageError(String msg) { super(msg); }
}
public class ClassCircularityError extends LinkageError {
	public ClassCircularityError() { }
	public ClassCircularityError(String msg) { super(msg); }
}
public class ClassFormatError extends LinkageError {
	public ClassFormatError() { }
	public ClassFormatError(String msg) { super(msg); }
}
public class IncompatibleClassChangeError extends LinkageError {
	public IncompatibleClassChangeError() { }
	public IncompatibleClassChangeError(String msg) { super(msg); }
}
public class AbstractMethodError extends IncompatibleClassChangeError {
	public AbstractMethodError() { }
	public AbstractMethodError(String msg) { super(msg); }
}
public class IllegalAccessError extends IncompatibleClassChangeError {
	public IllegalAccessError() { }
	public IllegalAccessError(String msg) { super(msg); }
}
public class InstantiationError extends IncompatibleClassChangeError {
	public InstantiationError() { }
	public InstantiationError(String msg) { super(msg); }
}
public class NoSuchFieldError extends IncompatibleClassChangeError {
	public NoSuchFieldError() { }
	public NoSuchFieldError(String msg) { super(msg); }
}
public class NoSuchMethodError extends IncompatibleClassChangeError {
	public NoSuchMethodError() { }
	public NoSuchMethodError(String msg) { super(msg); }
}
public class NoClassDefFoundError extends LinkageError {
	public NoClassDefFoundError() { }
	public NoClassDefFoundError(String msg) { super(msg); }
}
public class UnsatisfiedLinkError extends LinkageError {
	public UnsatisfiedLinkError() { }
	public UnsatisfiedLinkError(String msg) { super(msg); }
}
public class VerifyError extends LinkageError {
	public VerifyError() { }
	public VerifyError(String msg) { super(msg); }
}
public class VirtualMachineError extends Error {
	public VirtualMachineError() { }
	public VirtualMachineError(String msg) { super(msg); }
}
public class InternalError extends VirtualMachineError {
	public InternalError() { }
	public InternalError(String msg) { super(msg); }
}
public class OutOfMemoryError extends VirtualMachineError {
	public OutOfMemoryError() { }
	public OutOfMemoryError(String msg) { super(msg); }
}
public class StackOverflowError extends VirtualMachineError {
	public StackOverflowError() { }
	public StackOverflowError(String msg) { super(msg); }
}
public class UnknownError extends VirtualMachineError {
	public UnknownError() { }
	public UnknownError(String msg) { super(msg); }
}
public class ThreadDeath extends Error {
	public ThreadDeath() { }
	public ThreadDeath(String msg) { super(msg); }
}
public class Exception extends Throwable {
	public Exception() { }
	public Exception(String msg) { super(msg); }
}
public class ClassNotFoundException extends Exception {
	public ClassNotFoundException() { }
	public ClassNotFoundException(String msg) { super(msg); }
}
public class CloneNotSupportedException extends Exception {
	public CloneNotSupportedException() { }
	public CloneNotSupportedException(String msg) { super(msg); }
}
public class IllegalAccessException extends Exception {
	public IllegalAccessException() { }
	public IllegalAccessException(String msg) { super(msg); }
}
public class InstantiationException extends Exception {
	public InstantiationException() { }
	public InstantiationException(String msg) { super(msg); }
}
public class InterruptedException extends Exception {
	public InterruptedException() { }
	public InterruptedException(String msg) { super(msg); }
}
public class RuntimeException extends Exception {
	public RuntimeException() { }
	public RuntimeException(String msg) { super(msg); }
}
public class ArithmeticException extends RuntimeException {
	public ArithmeticException() { }
	public ArithmeticException(String msg) { super(msg); }
}
public class ArrayStoreException extends RuntimeException {
	public ArrayStoreException() { }
	public ArrayStoreException(String msg) { super(msg); }
}
public class ClassCastException extends RuntimeException {
	public ClassCastException() { }
	public ClassCastException(String msg) { super(msg); }
}
public class IllegalArgumentException extends RuntimeException {
	public IllegalArgumentException() { }
	public IllegalArgumentException(String msg) { super(msg); }
}
public class IllegalThreadStateException extends IllegalArgumentException {
	public IllegalThreadStateException() { }
	public IllegalThreadStateException(String msg) { super(msg); }
}
public class NumberFormatException extends IllegalArgumentException {
	public NumberFormatException() { }
	public NumberFormatException(String msg) { super(msg); }
}
public class IllegalMonitorStateException extends RuntimeException {
	public IllegalMonitorStateException() { }
	public IllegalMonitorStateException(String msg) { super(msg); }
}
public class IndexOutOfBoundsException extends RuntimeException {
	public IndexOutOfBoundsException() { }
	public IndexOutOfBoundsException(String msg) { super(msg); }
}
public class NegativeArraySizeException extends RuntimeException {
	public NegativeArraySizeException() { }
	public NegativeArraySizeException(String msg) { super(msg); }
}
public class NullPointerException extends RuntimeException {
	public NullPointerException() { }
	public NullPointerException(String msg) { super(msg); }
}
public class SecurityException extends RuntimeException {
	public SecurityException() { }
	public SecurityException(String msg) { super(msg); }
}