public static Object invoke(Method method, Object target, Object[] args) { if (method == null) { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_18"); throw new BonitaRuntimeException(message); } try { if (LOG.isLoggable(Level.FINE)) { LOG.fine("invoking '" + method.getName() + "' on '" + target + "' with " + ArrayUtil.toString(args)); } if (!method.isAccessible()) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("making method accessible"); } method.setAccessible(true); } return method.invoke(target, args); } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_19", method.getName(), ArrayUtil.toString(args), target, targetException.getMessage()); throw new BonitaRuntimeException(message, targetException); } catch (Exception e) { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_20", method.getName(), ArrayUtil.toString(args), target, e.getMessage()); throw new BonitaRuntimeException(message, e); } }
public static Object invoke(Method method, Object target, Object[] args) { if (method == null) { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_18"); throw new BonitaRuntimeException(message); } try { if (LOG.isLoggable(Level.FINE)) { LOG.fine("invoking '" + method.getName() + "' on '" + target + "' with " + ArrayUtil.toString(args)); } if (!method.isAccessible()) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("making method accessible"); } method.setAccessible(true); } return method.invoke(target, args); } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_19", method.getName(), ArrayUtil.toString(args), target, targetException.getMessage()); throw new BonitaRuntimeException(message, targetException); } catch (Exception e) { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_20", method.getName(), ArrayUtil.toString(args), target, e.getMessage()); throw new BonitaRuntimeException(message, e); } }
public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>[] parameterTypes) { Constructor<T> constructor = null; try { constructor = clazz.getDeclaredConstructor(parameterTypes); if (LOG.isLoggable(Level.FINE)) { LOG.fine("found constructor " + clazz.getName() + "(" + ArrayUtil.toString(parameterTypes) + ")"); } } catch (SecurityException e) { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_6", clazz.getName(), getParameterTypesText(parameterTypes)); throw new BonitaRuntimeException(message, e); } catch (NoSuchMethodException e) { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_7", clazz.getName(), getParameterTypesText(parameterTypes)); throw new BonitaRuntimeException(message, e); } return constructor; }
private static Method getMethod(Class<?> clazz, String methodName, Class<?>[] parameterTypes, Class<?> original) { Method method = null; try { method = clazz.getDeclaredMethod(methodName, parameterTypes); if (LOG.isLoggable(Level.FINE)) { LOG.fine("found method " + clazz.getName() + "." + methodName + "(" + ArrayUtil.toString(parameterTypes) + ")"); } } catch (SecurityException e) { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_10", clazz.getName(), methodName, getParameterTypesText(parameterTypes)); throw new BonitaRuntimeException(message, e); } catch (NoSuchMethodException e) { if (clazz.getSuperclass() != null) { return getMethod(clazz.getSuperclass(), methodName, parameterTypes, original); } else { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_11", original.getName(), methodName, getParameterTypesText(parameterTypes)); throw new BonitaRuntimeException(message, e); } } return method; }
public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>[] parameterTypes) { Constructor<T> constructor = null; try { constructor = clazz.getDeclaredConstructor(parameterTypes); if (LOG.isLoggable(Level.FINE)) { LOG.fine("found constructor " + clazz.getName() + "(" + ArrayUtil.toString(parameterTypes) + ")"); } } catch (SecurityException e) { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_6", clazz.getName(), getParameterTypesText(parameterTypes)); throw new BonitaRuntimeException(message, e); } catch (NoSuchMethodException e) { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_7", clazz.getName(), getParameterTypesText(parameterTypes)); throw new BonitaRuntimeException(message, e); } return constructor; }
private static Method getMethod(Class<?> clazz, String methodName, Class<?>[] parameterTypes, Class<?> original) { Method method = null; try { method = clazz.getDeclaredMethod(methodName, parameterTypes); if (LOG.isLoggable(Level.FINE)) { LOG.fine("found method " + clazz.getName() + "." + methodName + "(" + ArrayUtil.toString(parameterTypes) + ")"); } } catch (SecurityException e) { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_10", clazz.getName(), methodName, getParameterTypesText(parameterTypes)); throw new BonitaRuntimeException(message, e); } catch (NoSuchMethodException e) { if (clazz.getSuperclass() != null) { return getMethod(clazz.getSuperclass(), methodName, parameterTypes, original); } else { String message = ExceptionManager.getInstance().getFullMessage( "bp_RU_11", original.getName(), methodName, getParameterTypesText(parameterTypes)); throw new BonitaRuntimeException(message, e); } } return method; }
if (constructor == null) { String message = ExceptionManager.getInstance().getFullMessage( "bp_OD_2", clazz.getName(), ArrayUtil.toString(args)); throw new WireException(message);