Mercurial > projects > dwt2
annotate base/src/java/lang/exceptions.d @ 120:536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
===D2===
* added [Try]Immutable/Const/Shared templates to work with differenses in D1/D2 instead of version statements
used these templates to work with strict type storage rules of dmd-2.053
* com.ibm.icu now also compilable with D2, but not tested yet
* small fixes
Snippet288 - shared data is in TLS
===Phobos===
* fixed critical bugs in Phobos implemention
completely incorrect segfault prone fromStringz (Linux's port ruthless killer)
terrible, incorrect StringBuffer realization (StyledText killer)
* fixed small bugs as well
Snippet72 - misprint in the snippet
* implemented missed functionality for Phobos
ByteArrayOutputStream implemented (image loading available)
formatting correctly works for all DWT's cases
As a result, folowing snippets now works with Phobos (Snippet### - what is fixed):
Snippet24, 42, 111, 115, 130, 235, 276 - bad string formatting
Snippet48, 282 - crash on image loading
Snippet163, 189, 211, 213, 217, 218, 222 - crash on copy/cut in StyledText
Snippet244 - hang-up
===Tango===
* few changes for the latest Tango trunc-r5661
* few small performance improvments
===General===
* implMissing-s for only one version changed to implMissingInTango/InPhobos
* incorrect calls to Format in toString-s fixed
* fixed loading \uXXXX characters in ResourceBundle
* added good UTF-8 support for StyledText, TextLayout (Win32) and friends
UTF functions revised and tested. It is now in java.nonstandard.*Utf modules
StyledText and TextLayout (Win32) modules revised for UTF-8 support
* removed small diferences in most identical files in *.swt.* folders
*.swt.internal.image, *.swt.events and *.swt.custom are identical in Win32/Linux32
now 179 of 576 (~31%) files in *.swt.* folders are fully identical
* Win32: snippets now have right subsystem, pretty icons and native system style controls
* small fixes in snippets
Snippet44 - it's not Snippet44
Snippet212 - functions work with different images and offsets arrays
Win32: Snippet282 - crash on close if the button has an image
Snippet293 - setGrayed is commented
and others
Win32: As a result, folowing snippets now works
Snippet68 - color doesn't change
Snippet163, 189, 211, 213, 217, 218, 222 - UTF-8 issues (see above)
Snippet193 - no tabel headers
author | Denis Shelomovskij <verylonglogin.reg@gmail.com> |
---|---|
date | Sat, 09 Jul 2011 15:50:20 +0300 |
parents | 9f4c18c268b2 |
children |
rev | line source |
---|---|
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
1 module java.lang.exceptions; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
2 |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
3 import java.lang.util; |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
4 import java.lang.String; |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
5 |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
6 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
7 static import tango.core.Exception; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
8 public alias tango.core.Exception.IllegalArgumentException IllegalArgumentException; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
9 public alias tango.core.Exception.IOException IOException; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
10 public alias tango.core.Exception.PlatformException PlatformException; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
11 public alias tango.core.Exception.ArrayBoundsException ArrayIndexOutOfBoundsException; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
12 public alias tango.core.Exception.NoSuchElementException NoSuchElementException; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
13 public alias tango.core.Exception.UnicodeException UnicodeException; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
14 alias Exception Throwable; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
15 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
16 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
17 static import core.exception; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
18 public alias core.exception.RangeError ArrayIndexOutOfBoundsException; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
19 |
26 | 20 class PlatformException : Exception { |
21 this( String e = null ){ | |
22 super(e); | |
23 } | |
24 } | |
25 | |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
26 class IllegalArgumentException : Exception { |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
27 this( String e = null ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
28 super(e); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
29 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
30 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
31 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
32 class IOException : Exception { |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
33 this( String e = null ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
34 super(e); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
35 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
36 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
37 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
38 class NoSuchElementException : Exception { |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
39 this( String e = null ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
40 super(e); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
41 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
42 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
43 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
44 class UnicodeException : Exception { |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
45 this( String msg, int idx){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
46 super( "" ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
47 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
48 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
49 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
50 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
51 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
52 class InternalError : Exception { |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
53 this( String file, long line, String e = null ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
54 super(e); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
55 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
56 } |
6
f36c67707cb3
Removed import to tango.core.Exception
Frank Benoit <benoit@tionex.de>
parents:
2
diff
changeset
|
57 |
98
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
58 class ArithmeticException : Exception { |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
59 this( String e = null ){ |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
60 super(e); |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
61 } |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
62 } |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
63 |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
64 class ClassCastException : Exception { |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
65 this( String e = null ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
66 super(e); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
67 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
68 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
69 |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
70 class IllegalStateException : Exception { |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
71 this( String e = null ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
72 super(e); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
73 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
74 this( Exception e ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
75 super(e.toString); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
76 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
77 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
78 |
98
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
79 class NoSuchMethodException : Exception { |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
80 this( String e = null){ |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
81 super(e); |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
82 } |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
83 } |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
84 |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
85 class IllegalAccessException : Exception { |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
86 this( String e = null){ |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
87 super(e); |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
88 } |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
89 } |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
90 |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
91 class SecurityException : Exception { |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
92 this( String e = null){ |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
93 super(e); |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
94 } |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
95 } |
48d4ee626868
rm databinding.observable seems to be duplicate, databinding.beans now building
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
96 |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
97 class IndexOutOfBoundsException : Exception { |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
98 this( String e = null){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
99 super(e); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
100 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
101 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
102 |
120
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
112
diff
changeset
|
103 class StringIndexOutOfBoundsException : IndexOutOfBoundsException { |
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
112
diff
changeset
|
104 this( String e = null){ |
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
112
diff
changeset
|
105 super(e); |
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
112
diff
changeset
|
106 } |
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
112
diff
changeset
|
107 } |
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
112
diff
changeset
|
108 |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
109 class InterruptedException : Exception { |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
110 this( String e = null ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
111 super(e); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
112 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
113 this( Exception e ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
114 super(e.toString); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
115 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
116 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
117 |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
118 class NullPointerException : Exception { |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
119 this( String e = null ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
120 super(e); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
121 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
122 this( Exception e ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
123 super(e.toString); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
124 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
125 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
126 |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
127 class NumberFormatException : IllegalArgumentException { |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
128 this( String e ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
129 super(e); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
130 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
131 this( Exception e ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
132 super(e.toString); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
133 } |
84 | 134 public String getMessage(){ |
135 return msg; | |
136 } | |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
137 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
138 |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
139 class RuntimeException : Exception { |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
140 this( String file, long line, String msg = null){ |
112 | 141 super( msg, file, cast(size_t) line ); |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
142 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
143 this( String e = null){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
144 super(e); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
145 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
146 this( Exception e ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
147 super(e.toString); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
148 next = e; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
149 } |
84 | 150 public String getMessage(){ |
151 return msg; | |
152 } | |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
153 public Throwable getCause() { |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
154 return next; // D2 has next of type Throwable |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
155 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
156 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
157 |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
158 class UnsupportedOperationException : RuntimeException { |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
159 this( String e = null){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
160 super(e); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
161 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
162 this( Exception e ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
163 super(e.toString); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
164 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
165 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
166 |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
167 /// Extension to the D Exception |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
168 String ExceptionGetLocalizedMessage( Exception e ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
169 return e.msg; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
170 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
171 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
172 /// Extension to the D Exception |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
173 void ExceptionPrintStackTrace( Exception e ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
174 ExceptionPrintStackTrace( e, & getDwtLogger().error ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
175 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
176 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
177 /// Extension to the D Exception |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
178 void ExceptionPrintStackTrace( Throwable e, void delegate ( String file, ulong line, String fmt, ... ) dg ){ |
112 | 179 version(Tango){ |
180 Throwable exception = e; | |
181 while( exception !is null ){ | |
182 dg( exception.file, exception.line, "Exception in {}({}): {}", exception.file, exception.line, exception.msg ); | |
183 if( exception.info !is null ){ | |
184 foreach( frame; exception.info ){ | |
185 dg( exception.file, exception.line, "trc {} {}", frame.file, frame.line ); | |
186 } | |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
187 } |
112 | 188 exception = exception.next; |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
189 } |
112 | 190 } else { // Phobos |
191 Throwable exception = e; | |
192 while( exception !is null ){ | |
193 dg( exception.file, exception.line, "Exception in {}({}): {}", exception.file, exception.line, exception.msg ); | |
194 if( exception.info !is null ){ | |
195 foreach( line, file; exception.info ){ | |
196 dg( exception.file, exception.line, "trc {} {}", file, line ); | |
197 } | |
198 } | |
199 exception = exception.next; | |
200 } | |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
201 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
202 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
203 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
204 void PrintStackTrace( int deepth = 100, String prefix = "trc" ){ |
112 | 205 version(Tango){ |
206 auto e = new Exception( null ); | |
207 int idx = 0; | |
208 const start = 3; | |
209 foreach( frame; e.info ){ | |
210 if( idx >= start && idx < start+deepth ) { | |
211 getDwtLogger().trace( __FILE__, __LINE__, "{} {}: {}", prefix, frame.file, frame.line ); | |
212 } | |
213 idx++; | |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
214 } |
112 | 215 } else { // Phobos |
216 auto e = new Exception( null ); | |
217 int idx = 0; | |
218 const start = 3; | |
219 foreach( line, file; e.info ){ | |
220 if( idx >= start && idx < start+deepth ) { | |
221 getDwtLogger().trace( __FILE__, __LINE__, "{} {}: {}", prefix, file, line ); | |
222 } | |
223 idx++; | |
224 } | |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
225 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
6
diff
changeset
|
226 } |