/** {@inheritDoc} */ public Object execute(String method, @SuppressWarnings("unchecked") Vector params) throws Exception { log().debug("calling: "+method+'('+toArgList(params)+')'); MethodInvoker invoker = new ArgumentConvertingMethodInvoker(); invoker.setTargetObject(this.proxy); invoker.setTargetMethod(getMethodName(method)); invoker.setArguments(params.toArray()); invoker.prepare(); try { Object returnValue = invoker.invoke(); if (returnValue == null && invoker.getPreparedMethod().getReturnType() == Void.TYPE) { returnValue = "void"; } else if (returnValue instanceof Map<?,?> && !(returnValue instanceof Hashtable<?,?>)) { returnValue = new Hashtable<Object, Object>((Map<?, ?>)returnValue); } else if (returnValue instanceof Collection<?> && !(returnValue instanceof Vector<?>)) { returnValue = new Vector<Object>((Collection<?>)returnValue); } log().debug("returning from: "+method+'('+toArgList(params)+") result = "+returnValue); return returnValue; } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); if (targetException instanceof IllegalArgumentException) { throw new MsgPreservingXmlRpcException(XmlRpcConstants.FAULT_INVALID_DATA, targetException.getMessage()); } else if (targetException instanceof MalformedURLException) { throw new MsgPreservingXmlRpcException(XmlRpcConstants.FAULT_INVALID_URL, targetException.getMessage()); } else if (targetException instanceof Exception && targetException.toString() != null) { throw (Exception)targetException; } String msg = targetException.toString(); if (msg == null) msg = targetException.getClass().getName(); Exception ex = new Exception(msg, targetException); ex.setStackTrace(targetException.getStackTrace()); throw ex; } }