diff --git a/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/BinderHook.java b/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/BinderHook.java index e6cea57..35a882d 100644 --- a/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/BinderHook.java +++ b/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/BinderHook.java @@ -33,6 +33,7 @@ import com.morgoo.helper.MyProxy; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.Arrays; import java.util.List; /** @@ -58,7 +59,7 @@ abstract class BinderHook extends Hook implements InvocationHandler { } else { return method.invoke(mOldObj, args); } - } catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { Throwable cause = e.getTargetException(); if (cause != null && MyProxy.isMethodDeclaredThrowable(method, cause)) { throw cause; @@ -71,6 +72,27 @@ abstract class BinderHook extends Hook implements InvocationHandler { runtimeException.initCause(e); throw runtimeException; } + } catch (IllegalArgumentException e) { + try { + StringBuilder sb = new StringBuilder(); + sb.append(" DROIDPLUGIN{"); + if (method != null) { + sb.append("method[").append(method.toString()).append("]"); + } else { + sb.append("method[").append("NULL").append("]"); + } + if (args != null) { + sb.append("args[").append(Arrays.toString(args)).append("]"); + } else { + sb.append("args[").append("NULL").append("]"); + } + sb.append("}"); + + String message = e.getMessage() + sb.toString(); + throw new IllegalArgumentException(message, e); + } catch (Throwable e1) { + throw e; + } } catch (Throwable e) { if (MyProxy.isMethodDeclaredThrowable(method, e)) { throw e; diff --git a/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/ServiceManagerCacheBinderHook.java b/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/ServiceManagerCacheBinderHook.java index 307c244..8195561 100644 --- a/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/ServiceManagerCacheBinderHook.java +++ b/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/ServiceManagerCacheBinderHook.java @@ -38,6 +38,7 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.UndeclaredThrowableException; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -96,7 +97,7 @@ public class ServiceManagerCacheBinderHook extends Hook implements InvocationHan } else { return method.invoke(originService, args); } - } catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { Throwable cause = e.getTargetException(); if (cause != null && MyProxy.isMethodDeclaredThrowable(method, cause)) { throw cause; @@ -109,6 +110,27 @@ public class ServiceManagerCacheBinderHook extends Hook implements InvocationHan runtimeException.initCause(e); throw runtimeException; } + } catch (IllegalArgumentException e) { + try { + StringBuilder sb = new StringBuilder(); + sb.append(" DROIDPLUGIN{"); + if (method != null) { + sb.append("method[").append(method.toString()).append("]"); + } else { + sb.append("method[").append("NULL").append("]"); + } + if (args != null) { + sb.append("args[").append(Arrays.toString(args)).append("]"); + } else { + sb.append("args[").append("NULL").append("]"); + } + sb.append("}"); + + String message = e.getMessage() + sb.toString(); + throw new IllegalArgumentException(message, e); + } catch (Throwable e1) { + throw e; + } } catch (Throwable e) { if (MyProxy.isMethodDeclaredThrowable(method, e)) { throw e; diff --git a/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/proxy/ProxyHook.java b/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/proxy/ProxyHook.java index 563961a..0b41e2c 100644 --- a/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/proxy/ProxyHook.java +++ b/project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/proxy/ProxyHook.java @@ -32,8 +32,7 @@ import com.morgoo.helper.MyProxy; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.lang.reflect.UndeclaredThrowableException; -import java.net.DatagramSocket; +import java.util.Arrays; /** * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/14. @@ -74,6 +73,27 @@ public abstract class ProxyHook extends Hook implements InvocationHandler { runtimeException.initCause(e); throw runtimeException; } + } catch (IllegalArgumentException e) { + try { + StringBuilder sb = new StringBuilder(); + sb.append(" DROIDPLUGIN{"); + if (method != null) { + sb.append("method[").append(method.toString()).append("]"); + } else { + sb.append("method[").append("NULL").append("]"); + } + if (args != null) { + sb.append("args[").append(Arrays.toString(args)).append("]"); + } else { + sb.append("args[").append("NULL").append("]"); + } + sb.append("}"); + + String message = e.getMessage() + sb.toString(); + throw new IllegalArgumentException(message, e); + } catch (Throwable e1) { + throw e; + } } catch (Throwable e) { if (MyProxy.isMethodDeclaredThrowable(method, e)) { throw e;