public class HttpProxy{
public static <T> T getProxy(Class<T> c) {
return (T) Proxy.newProxyInstance(HttpProxy.class.getClassLoader(),
new Class<?>[] { c }, handler);
}
static class HttpInvocationHandler implements InvocationHandler {
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
Object obj = null;
try {
throw new CustomException()
}catch (CustomException e) {
throw e;
}
return obj;
}
}
}
method call:
try{
Res resp = HttpProxy.getProxy(IMODEL.class).login();
if (res != null){
return ok;
}
} catch (CustomException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch(Exception e){
}
If I install project.properties, I cannot catch my own exception.
If I do not install project.properties, it works fine.
like obfuscation with proguard vs. java.lang.reflect.Proxy
source
share