Catch callback's and apg-call's (are there any?) exceptions

This commit is contained in:
Markus Doits 2011-01-20 16:53:51 +00:00
parent 72ab7fb25f
commit d4901f5999

View File

@ -1,5 +1,6 @@
package org.thialfihar.android.apg.utils; package org.thialfihar.android.apg.utils;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import android.content.Context; import android.content.Context;
@ -42,7 +43,12 @@ public class ApgCon {
Log.d(TAG, "Callback executed"); Log.d(TAG, "Callback executed");
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
Log.w(TAG, "Exception in callback: Method '" + callback_method + "' not found"); 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) { } catch (Exception e) {
Log.w(TAG, "Exception on callback: (" + e.getClass() + ") " + e.getMessage()); Log.w(TAG, "Exception on callback: (" + e.getClass() + ") " + e.getMessage());
warning_list.add("(LOCAL) Could not execute callback (" + e.getClass() + "): " + e.getMessage()); warning_list.add("(LOCAL) Could not execute callback (" + e.getClass() + "): " + e.getMessage());
@ -303,6 +309,11 @@ public class ApgCon {
error_list.add("(LOCAL) Remote call not known (" + function + "): " + e.getMessage()); error_list.add("(LOCAL) Remote call not known (" + function + "): " + e.getMessage());
local_error = error.CALL_NOT_KNOWN; local_error = error.CALL_NOT_KNOWN;
return false; 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) { } 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()); error_list.add("(LOCAL) Generic error (" + e.getClass() + "): " + e.getMessage());