IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
JavaException.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2014 Jeroen Frijters
3
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
7
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
11
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
19
20 Jeroen Frijters
21 jeroen@frijters.net
22
23*/
24using System;
25
26namespace IKVM.Runtime
27{
28
32 abstract class RetargetableJavaException : ApplicationException
33 {
34
39 internal RetargetableJavaException(string msg) :
40 base(msg)
41 {
42
43 }
44
50 internal RetargetableJavaException(string message, Exception innerException) :
51 base(message, innerException)
52 {
53
54 }
55
56 internal static string Format(string s, object[] args)
57 {
58 return args == null || args.Length == 0 ? s : string.Format(s, args);
59 }
60
61#if !IMPORTER && !FIRST_PASS && !EXPORTER
62
63 internal abstract Exception ToJava();
64
65#elif FIRST_PASS
66
67 internal virtual Exception ToJava()
68 {
69 return null;
70 }
71
72#endif
73
74 }
75
83 {
84
90 internal ClassLoadingException(Exception innerException, string className) :
91 base(className, innerException)
92 {
93
94 }
95
96#if !IMPORTER && !FIRST_PASS && !EXPORTER
97
98 internal override Exception ToJava()
99 {
100 if (!(InnerException is java.lang.Error) && !(InnerException is java.lang.RuntimeException))
101 return new java.lang.NoClassDefFoundError(Message.Replace('.', '/')).initCause(InnerException);
102
103 return InnerException;
104 }
105
106#endif
107
108 }
109
111 {
112
117 internal LinkageError(string message) : base(message)
118 {
119
120 }
121
127 internal LinkageError(string message, Exception innerException) :
128 base(message, innerException)
129 {
130
131 }
132
133#if !IMPORTER && !FIRST_PASS && !EXPORTER
134
135 internal override Exception ToJava()
136 {
137 return new java.lang.LinkageError(Message);
138 }
139
140#endif
141
142 }
143
145 {
146
150 internal VerifyError() :
151 base("")
152 {
153
154 }
155
160 internal VerifyError(string message) :
161 base(message)
162 {
163
164 }
165
171 internal VerifyError(string message, Exception innerException) : base(message, innerException)
172 {
173
174 }
175
176#if !IMPORTER && !FIRST_PASS && !EXPORTER
177
178 internal override Exception ToJava()
179 {
180 return new java.lang.VerifyError(Message);
181 }
182
183#endif
184
185 }
186
188 {
189
194 internal ClassNotFoundException(string message) :
195 base(message)
196 {
197
198 }
199
200#if !IMPORTER && !FIRST_PASS && !EXPORTER
201
202 internal override Exception ToJava()
203 {
204 return new java.lang.NoClassDefFoundError(Message);
205 }
206
207#endif
208
209 }
210
212 {
213
218 internal ClassCircularityError(string message) :
219 base(message)
220 {
221
222 }
223
224#if !IMPORTER && !FIRST_PASS && !EXPORTER
225
226 internal override Exception ToJava()
227 {
228 return new java.lang.ClassCircularityError(Message);
229 }
230
231#endif
232
233 }
234
236 {
237
242 internal NoClassDefFoundError(string message) :
243 base(message)
244 {
245
246 }
247
248#if !IMPORTER && !FIRST_PASS && !EXPORTER
249
250 internal override Exception ToJava()
251 {
252 return new java.lang.NoClassDefFoundError(Message);
253 }
254
255#endif
256
257 }
258
260 {
261
266 internal IncompatibleClassChangeError(string message) :
267 base(message)
268 {
269
270 }
271
272#if !IMPORTER && !FIRST_PASS && !EXPORTER
273
274 internal override Exception ToJava()
275 {
276 return new java.lang.IncompatibleClassChangeError(Message);
277 }
278
279#endif
280
281 }
282
284 {
285
290 internal IllegalAccessError(string message) :
291 base(message)
292 {
293
294 }
295
296#if !IMPORTER && !FIRST_PASS && !EXPORTER
297 internal override Exception ToJava()
298 {
299 return new java.lang.IllegalAccessError(Message);
300 }
301
302#endif
303
304 }
305
307 {
308
314 internal ClassFormatError(string message, params object[] args) :
315 base(Format(message, args))
316 {
317
318 }
319
320#if !IMPORTER && !FIRST_PASS && !EXPORTER
321
322 internal override Exception ToJava()
323 {
324 return new java.lang.ClassFormatError(Message);
325 }
326
327#endif
328
329 }
330
332 {
333
338 internal UnsupportedClassVersionError(string message) :
339 base(message)
340 {
341
342 }
343
344#if !IMPORTER && !FIRST_PASS && !EXPORTER
345
346 internal override Exception ToJava()
347 {
348 return new java.lang.UnsupportedClassVersionError(Message);
349 }
350
351#endif
352
353 }
354
356 {
357
362 internal JavaSecurityException(string msg) :
363 base(msg)
364 {
365
366 }
367
368#if !IMPORTER && !FIRST_PASS && !EXPORTER
369
370 internal override Exception ToJava()
371 {
372 return new java.lang.SecurityException(Message);
373 }
374
375#endif
376
377 }
378
379}
This is not a Java exception, but instead it wraps a Java exception that was thrown by a class loader...
.NET exception that corresponds to a Java exception.