From d4901f5999b51398b3a2ff43ba82f356225f4fef Mon Sep 17 00:00:00 2001 From: Markus Doits Date: Thu, 20 Jan 2011 16:53:51 +0000 Subject: Catch callback's and apg-call's (are there any?) exceptions --- src/org/thialfihar/android/apg/utils/ApgCon.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/thialfihar/android/apg/utils/ApgCon.java b/src/org/thialfihar/android/apg/utils/ApgCon.java index 16ba94a1f..4852ad548 100644 --- a/src/org/thialfihar/android/apg/utils/ApgCon.java +++ b/src/org/thialfihar/android/apg/utils/ApgCon.java @@ -1,5 +1,6 @@ package org.thialfihar.android.apg.utils; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import android.content.Context; @@ -42,7 +43,12 @@ public class ApgCon { Log.d(TAG, "Callback executed"); } catch (NoSuchMethodException e) { Log.w(TAG, "Exception in callback: Method '" + callback_method + "' not found"); - warning_list.add("(LOCAL) Could not execute callback, method '" + callback_method + "' not found"); + warning_list.add("(LOCAL) Could not execute callback, method '" + callback_method + "()' not found"); + } catch (InvocationTargetException e) { + Throwable orig = e.getTargetException(); + Log.w(TAG, "Exception of type '" + orig.getClass() + "' in callback's method '" + callback_method + "()':" + orig.getMessage()); + warning_list.add("(LOCAL) Exception of type '" + orig.getClass() + "' in callback's method '" + callback_method + "()':" + + orig.getMessage()); } catch (Exception e) { Log.w(TAG, "Exception on callback: (" + e.getClass() + ") " + e.getMessage()); warning_list.add("(LOCAL) Could not execute callback (" + e.getClass() + "): " + e.getMessage()); @@ -303,8 +309,13 @@ public class ApgCon { error_list.add("(LOCAL) Remote call not known (" + function + "): " + e.getMessage()); local_error = error.CALL_NOT_KNOWN; return false; + } catch (InvocationTargetException e) { + Throwable orig = e.getTargetException(); + Log.w(TAG, "Exception of type '" + orig.getClass() + "' on AIDL call '" + function + "':" + orig.getMessage()); + error_list.add("(LOCAL) Exception of type '" + orig.getClass() + "' on AIDL call '" + function + "':" + orig.getMessage()); + return false; } catch (Exception e) { - Log.e(TAG, "Generic error (" + e.getClass() + "): " + e.getMessage()); + Log.e(TAG, "Generic error (" + e.getClass() + "): " + e.getMessage()); error_list.add("(LOCAL) Generic error (" + e.getClass() + "): " + e.getMessage()); local_error = error.GENERIC; return false; -- cgit v1.2.3