/** * Handle the exception, displaying a nice message and converting to {@link EPException}. * @param logger is the logger to use for error logging * @param e is the exception * @param params the method parameters * @param subscriber the object to deliver to * @param method the method to call * @throws EPException converted from the passed invocation exception */ protected static void handle(Log logger, InvocationTargetException e, Object[] params, Object subscriber, FastMethod method) throws EPException { String message = "Invocation exception when invoking method '" + method.getName() + "' on subscriber class '" + subscriber.getClass().getSimpleName() + "' for parameters " + ((params == null) ? "null" : Arrays.toString(params)) + " : " + e.getTargetException().getClass().getSimpleName() + " : " + e.getTargetException().getMessage(); logger.error(message, e.getTargetException()); throw new EPException(message, e.getTargetException()); }
if (value == null) log.warn("Expected non-null return result from method '" + method.getName() + "', but received null value"); continue; log.warn("Expected Map-type return result from method '" + method.getName() + "', but received type '" + value.getClass() + "'"); continue; log.warn("Expected Map-type return result from method '" + method.getName() + "', but received type '" + invocationResult.getClass() + "'"); throw new EPException("Method '" + method.getName() + "' of class '" + method.getJavaMethod().getDeclaringClass().getName() + "' reported an exception: " + ex.getTargetException(), ex.getTargetException());
String message = "Method '" + staticMethod.getName() + "' of class '" + className + "' reported an exception: " +
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData) { // get underlying event EventBean event = eventsPerStream[streamNum]; if (event == null) { return null; } Object underlying = event.getUnderlying(); // get parameters List<ExprNode> childNodes = this.getChildNodes(); Object[] args = new Object[childNodes.size()]; int count = 0; for(ExprNode childNode : childNodes) { args[count++] = childNode.evaluate(eventsPerStream, isNewData); } try { return instanceMethod.invoke(underlying, args); } catch (InvocationTargetException e) { log.warn("Error evaluating instance method by name '" + instanceMethod.getName() + "': " + e.getMessage(), e); return null; } } }
protected BulkBean buildGetBulkBean(Introspector is, Class<?> clazz, String[] fields, Class[] args) { if (fields.length != args.length) { throw new BeanMappingException("fields and args size is not match!"); } String[] getters = new String[fields.length]; String[] setters = new String[fields.length]; for (int i = 0; i < fields.length; i++) { String property = fields[i]; Class arg = args[i]; FastMethod setMethod = FastPropertySetExecutor.discover(is, clazz, property, arg); FastMethod getMethod = FastPropertyGetExecutor.discover(is, clazz, property); if (setMethod == null) { throw new BeanMappingException("class[" + clazz.getName() + "] field[" + property + "] arg[" + arg.getName() + "] set Method is not exist!"); } if (getMethod == null) { throw new BeanMappingException("class[" + clazz.getName() + "] field[" + property + "] get Method is not exist!"); } if (getMethod.getReturnType() != arg) { throw new BeanMappingException("class[" + clazz.getName() + "] field[" + property + "] getMethod does not match declared type"); } setters[i] = setMethod.getName(); getters[i] = getMethod.getName(); } bulkBean = BulkBean.create(clazz, getters, setters, args); return bulkBean; }
if ((beanClass == void.class) || (beanClass == Void.class) || (JavaClassHelper.isJavaBuiltinDataType(beanClass))) throw new ExprValidationException("Invalid return type for static method '" + staticMethod.getName() + "' of class '" + methodStreamSpec.getClassName() + "', expecting a Java class");