private Object invoke(Object pInstance, Method pMethod, Object[] pArgs) throws XmlRpcException { try { return pMethod.invoke(pInstance, pArgs); } catch (IllegalAccessException e) { throw new XmlRpcException("Illegal access to method " + pMethod.getName() + " in class " + clazz.getName(), e); } catch (IllegalArgumentException e) { throw new XmlRpcException("Illegal argument for method " + pMethod.getName() + " in class " + clazz.getName(), e); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof XmlRpcException) { throw (XmlRpcException) t; } throw new XmlRpcInvocationException("Failed to invoke method " + pMethod.getName() + " in class " + clazz.getName() + ": " + t.getMessage(), t); } } }
public Object invoke(Object pProxy, Method pMethod, Object[] pArgs) throws Throwable { String tracClassName = Utils.findTracClassName(aClass); if(tracClassName == null){ throw new TracException(MessageUtils.registerErrorLog(log, "core.no.trac.classname.found", aClass.getName())); } TracClassMethod tracClassMethodMetadata = Utils.getTracClassMethodAnnotation(pMethod); String methodName = Utils.buildTracMethodNameInvocation(tracClassName, tracClassMethodMetadata); Object result = null; try { result = getClient().execute(methodName, pArgs); } catch (XmlRpcInvocationException e) { throw new TracException(MessageUtils.registerErrorLog(log, "core.invocation.factory.invocation.exception", e.getMessage()), e); } catch(XmlRpcException e){ throw new TracException(MessageUtils.registerErrorLog(log, "core.invocation.factory.xmlrpc.exception", e.getMessage()), e); } catch (Throwable e){ throw new TracException(MessageUtils.registerErrorLog(log, "core.invocation.factory.unknown.exception", e.getMessage()), e); } Class returnType = tracClassMethodMetadata.tracReturnType(); if(returnType == Object.class){ returnType = pMethod.getReturnType(); } TypeConverter typeConverter = typeConverterFactory.getTypeConverter(returnType); return typeConverter.convert(result); } });
private Object invoke(Object pInstance, Method pMethod, Object[] pArgs) throws XmlRpcException { try { return pMethod.invoke(pInstance, pArgs); } catch (IllegalAccessException e) { throw new XmlRpcException("Illegal access to method " + pMethod.getName() + " in class " + clazz.getName(), e); } catch (IllegalArgumentException e) { throw new XmlRpcException("Illegal argument for method " + pMethod.getName() + " in class " + clazz.getName(), e); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof XmlRpcException) { throw (XmlRpcException) t; } throw new XmlRpcInvocationException("Failed to invoke method " + pMethod.getName() + " in class " + clazz.getName() + ": " + t.getMessage(), t); } } }
private Object invoke(Object pInstance, Method pMethod, Object[] pArgs) throws XmlRpcException { try { return pMethod.invoke(pInstance, pArgs); } catch (IllegalAccessException e) { throw new XmlRpcException("Illegal access to method " + pMethod.getName() + " in class " + clazz.getName(), e); } catch (IllegalArgumentException e) { throw new XmlRpcException("Illegal argument for method " + pMethod.getName() + " in class " + clazz.getName(), e); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof XmlRpcException) { throw (XmlRpcException) t; } throw new XmlRpcInvocationException("Failed to invoke method " + pMethod.getName() + " in class " + clazz.getName() + ": " + t.getMessage(), t); } } }