Example usage for org.springframework.scripting ScriptCompilationException ScriptCompilationException

List of usage examples for org.springframework.scripting ScriptCompilationException ScriptCompilationException

Introduction

In this page you can find the example usage for org.springframework.scripting ScriptCompilationException ScriptCompilationException.

Prototype

public ScriptCompilationException(ScriptSource scriptSource, String msg, Throwable cause) 

Source Link

Document

Constructor for ScriptCompilationException.

Usage

From source file:org.springframework.data.hadoop.scripting.Jsr223ScriptEvaluator.java

@Override
public Object evaluate(ScriptSource script, Map<String, Object> arguments) {
    ScriptEngine engine = discoverEngine(script, arguments);

    Bindings bindings = (!CollectionUtils.isEmpty(arguments) ? new SimpleBindings(arguments) : null);

    try {/*  w  ww  .  jav  a  2s  . c o m*/
        return (bindings == null ? engine.eval(script.getScriptAsString())
                : engine.eval(script.getScriptAsString(), bindings));
    } catch (IOException ex) {
        throw new ScriptCompilationException(script, "Cannot access script", ex);
    } catch (ScriptException ex) {
        throw new ScriptCompilationException(script, "Execution failure", ex);
    }
}