diff options
-rw-r--r-- | classpath/java/lang/ExceptionHelper.java | 33 | ||||
-rw-r--r-- | openjdk/map.xml | 10 | ||||
-rw-r--r-- | runtime/ExceptionHelper.cs | 41 |
3 files changed, 46 insertions, 38 deletions
diff --git a/classpath/java/lang/ExceptionHelper.java b/classpath/java/lang/ExceptionHelper.java index c2eeeacc..1d441a52 100644 --- a/classpath/java/lang/ExceptionHelper.java +++ b/classpath/java/lang/ExceptionHelper.java @@ -359,29 +359,6 @@ public final class ExceptionHelper } } - static String FilterMessage(String message) - { - if(message == null) - { - message = ""; - } - return message; - } - - static String GetMessageFromCause(Throwable cause) - { - if(cause == null) - { - return ""; - } - return cause.toString(); - } - - static String getLocalizedMessage(Throwable x) - { - return x.getMessage(); - } - static void fillInStackTrace(cli.System.Exception x) { synchronized (x) @@ -398,16 +375,6 @@ public final class ExceptionHelper } } - static String toString(Throwable x) - { - String message = x.getLocalizedMessage(); - if(message == null) - { - return x.getClass().getName(); - } - return x.getClass().getName() + ": " + message; - } - // also used by ikvm.extensions.ExtensionMethods.printStackTrace() public static Throwable UnmapException(Throwable t) { diff --git a/openjdk/map.xml b/openjdk/map.xml index 43e0be60..323ed7bc 100644 --- a/openjdk/map.xml +++ b/openjdk/map.xml @@ -1039,7 +1039,7 @@ <body> <ldarg_0 /> <ldarg_1 /> - <call class="java.lang.ExceptionHelper" name="FilterMessage" sig="(Ljava.lang.String;)Ljava.lang.String;" /> + <call class="cli.IKVM.NativeCode.java.lang.ExceptionHelper" name="FilterMessage" sig="(Ljava.lang.String;)Ljava.lang.String;" /> <call type="System.Exception" name=".ctor" sig="(Ljava.lang.String;)V" /> <ldarg_0 /> <ldarg_0 /> @@ -1069,7 +1069,7 @@ <body> <ldarg_0 /> <ldarg_1 /> - <call class="java.lang.ExceptionHelper" name="FilterMessage" sig="(Ljava.lang.String;)Ljava.lang.String;" /> + <call class="cli.IKVM.NativeCode.java.lang.ExceptionHelper" name="FilterMessage" sig="(Ljava.lang.String;)Ljava.lang.String;" /> <ldarg_2 /> <call type="System.Exception" name=".ctor" sig="(Ljava.lang.String;Ljava.lang.Throwable;)V" /> <ldarg_0 /> @@ -1102,7 +1102,7 @@ <body> <ldarg_0 /> <ldarg_1 /> - <call class="java.lang.ExceptionHelper" name="GetMessageFromCause" sig="(Ljava.lang.Throwable;)Ljava.lang.String;" /> + <call class="cli.IKVM.NativeCode.java.lang.ExceptionHelper" name="GetMessageFromCause" sig="(Ljava.lang.Throwable;)Ljava.lang.String;" /> <ldarg_1 /> <call type="System.Exception" name=".ctor" sig="(Ljava.lang.String;Ljava.lang.Throwable;)V" /> <ldarg_0 /> @@ -1158,7 +1158,7 @@ </alternateBody> </method> <method name="getLocalizedMessage" sig="()Ljava.lang.String;" modifiers="public"> - <redirect class="java.lang.ExceptionHelper" sig="(Ljava.lang.Throwable;)Ljava.lang.String;" type="static" /> + <redirect class="cli.IKVM.NativeCode.java.lang.ExceptionHelper" sig="(Ljava.lang.Throwable;)Ljava.lang.String;" type="static" /> </method> <method name="fillInStackTrace" sig="()Ljava.lang.Throwable;" modifiers="public"> <body> @@ -1324,7 +1324,7 @@ </alternateBody> </method> <method name="toString" sig="()Ljava.lang.String;" modifiers="public"> - <redirect class="java.lang.ExceptionHelper" sig="(Ljava.lang.Throwable;)Ljava.lang.String;" type="static" /> + <redirect class="cli.IKVM.NativeCode.java.lang.ExceptionHelper" sig="(Ljava.lang.Throwable;)Ljava.lang.String;" type="static" /> </method> <method name="GetObjectData" sig="(Lcli.System.Runtime.Serialization.SerializationInfo;Lcli.System.Runtime.Serialization.StreamingContext;)V" modifiers="public"> <attribute type="System.Security.Permissions.SecurityPermissionAttribute" sig="(Lcli.System.Security.Permissions.SecurityAction;)V"> diff --git a/runtime/ExceptionHelper.cs b/runtime/ExceptionHelper.cs index 9dfd7bf9..89d64d10 100644 --- a/runtime/ExceptionHelper.cs +++ b/runtime/ExceptionHelper.cs @@ -299,5 +299,46 @@ namespace IKVM.NativeCode.java.lang return list; } #endif + + internal static string FilterMessage(string message) + { + return message ?? ""; + } + + internal static string GetMessageFromCause(Exception cause) + { +#if FIRST_PASS + return null; +#else + if (cause == null) + { + return ""; + } + return global::java.lang.Object.instancehelper_toString(cause); +#endif + } + + internal static string getLocalizedMessage(Exception x) + { +#if FIRST_PASS + return null; +#else + return Throwable.instancehelper_getMessage(x); +#endif + } + + internal static string toString(Exception x) + { +#if FIRST_PASS + return null; +#else + string message = Throwable.instancehelper_getLocalizedMessage(x); + if (message == null) + { + return global::java.lang.Object.instancehelper_getClass(x).getName(); + } + return global::java.lang.Object.instancehelper_getClass(x).getName() + ": " + message; +#endif + } } } |