Commit d65a1e5
committed
[Java.Interop] JavaException.InnerException should elide Proxies.
Fixes: #1
JavaProxyThrowable is an internal type, and as such it shouldn't
"leak" if at all possible, e.g. if someone creates a
java.lang.Throwable in which the `cause` is a managed exception type
such as InvalidOperationException.
Previously, Exception.InnerException would have been the
JavaProxyThrowable, as JavaException._GetCause() would lookup a
JavaException instance. Returning a JavaProxyThrowable is ~useless;
it's not a public API, and thus nothing useful can be done with it
(short of resorting to Reflection).
Fix JavaException._GetCause() so that it instead uses
JavaVM.GetExceptionForThrowable(), which automatically "unwraps"
JavaProxyThrowable instances to return the wrapped Exception.1 parent 3398a48 commit d65a1e5
File tree
2 files changed
+36
-5
lines changed- src/Java.Interop
- Java.Interop
- Tests/Java.Interop
2 files changed
+36
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | 53 | | |
55 | | - | |
56 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
57 | 78 | | |
58 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
59 | 90 | | |
60 | 91 | | |
61 | 92 | | |
0 commit comments