@Override protected Object doInvoke(Method method, Object[] args) throws Throwable { IEvaluationContext forkedContext = context.fork(); if (args != null) { initializeClosureParameters(forkedContext, args); } IEvaluationResult result = interpreter.evaluate(closure.getExpression(), forkedContext, indicator); if (indicator.isCanceled()) throw new InterpreterCanceledException(); if (result.getException() != null) throw result.getException(); return result.getResult(); }
@Override public Object evaluateExpression(IValueProvider provider) throws Exception { IEvaluationContext context = contextProvider.get(); for (String name : getInputParameterNames()) { context.newValue(nameConverter.toQualifiedName(name), provider.getValue(name)); } IEvaluationResult result = interpreter.evaluate(xExpression, context, CancelIndicator.NullImpl); if (result == null) throw new ViatraQueryException(String.format( "XBase expression interpreter returned no result while evaluating expression %s in pattern %s.", xExpression, pattern), "XBase expression interpreter returned no result."); Throwable throwable = result.getException(); if (throwable instanceof Error) { throw (Error) throwable; } else if (throwable instanceof Exception) { throw (Exception) throwable; } else if (throwable != null) { throw new ViatraQueryException(String.format("Strange throwable (%s) encountered: %s", throwable.getClass() .getCanonicalName(), throwable.getMessage()), "Strange throwable encountered", throwable); } return result.getResult(); }
@Override public Object evaluateExpression(IValueProvider provider) throws Exception { IEvaluationContext context = contextProvider.get(); for (String name : getInputParameterNames()) { context.newValue(nameConverter.toQualifiedName(name), provider.getValue(name)); } IEvaluationResult result = interpreter.evaluate(xExpression, context, CancelIndicator.NullImpl); if (result == null) throw new IncQueryException(String.format( "XBase expression interpreter returned no result while evaluating expression %s in pattern %s.", xExpression, pattern), "XBase expression interpreter returned no result."); Throwable throwable = result.getException(); if (throwable instanceof Error) { throw (Error) throwable; } else if (throwable instanceof Exception) { throw (Exception) throwable; } else if (throwable != null) { throw new IncQueryException(String.format("Strange throwable (%s) encountered: %s", throwable.getClass() .getCanonicalName(), throwable.getMessage()), "Strange throwable encountered", throwable); } return result.getResult(); }
if (result.getException() != null) { throw new ScriptExecutionException(result.getException().getMessage(), result.getException()); return result.getResult(); } catch (Throwable e) { if (e instanceof ScriptExecutionException) {