aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/thialfihar/android/apg
diff options
context:
space:
mode:
authorMarkus Doits <markus.doits@gmail.com>2011-01-20 16:53:51 +0000
committerMarkus Doits <markus.doits@gmail.com>2011-01-20 16:53:51 +0000
commitd4901f5999b51398b3a2ff43ba82f356225f4fef (patch)
treec1afe0e55d9bc59462ba60192c1e91447fc0d781 /src/org/thialfihar/android/apg
parent72ab7fb25ffe193aa418ba0ba31fc292d8235e62 (diff)
downloadopen-keychain-d4901f5999b51398b3a2ff43ba82f356225f4fef.tar.gz
open-keychain-d4901f5999b51398b3a2ff43ba82f356225f4fef.tar.bz2
open-keychain-d4901f5999b51398b3a2ff43ba82f356225f4fef.zip
Catch callback's and apg-call's (are there any?) exceptions
Diffstat (limited to 'src/org/thialfihar/android/apg')
-rw-r--r--src/org/thialfihar/android/apg/utils/ApgCon.java15
1 files changed, 13 insertions, 2 deletions
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;