throw new BSFException("BeanShell script error: " + e3 + sourceInfo(source,lineNo,columnNo));
}
}
public Object eval(String source, int lineNo, int columnNo, Object expr) throws BSFException {
if (!(expr instanceof String)) throw new BSFException("BeanShell expression must be a string");
try {
//return interpreter.eval(((String) expr));
Interpreter.ParsedScript script = null;
if (source != null && source.length() > 0) {
script = parsedScripts.get(source);
if (script == null) {
synchronized (OfbizBshBsfEngine.class) {
script = parsedScripts.get(source);
if (script == null) {
script = interpreter.parseScript(source, new StringReader((String) expr));
Debug.logVerbose("Caching BSH script at: " + source, module);
parsedScripts.put(source, script);
}
}
}
} else {
script = interpreter.parseScript(source, new StringReader((String) expr));
}
return interpreter.evalParsedScript(script);
} catch (InterpreterError e) {
throw new BSFException("BeanShell interpreter internal error: "+ e + sourceInfo(source,lineNo,columnNo));
} catch (TargetError e2) {
Debug.logError(e2, "Error thrown in BeanShell script called through BSF at: " + sourceInfo(source,lineNo,columnNo), module);
//Debug.logError(e2.getTarget(), module);
throw new BSFException("The application script threw an exception: " + e2 + " " + sourceInfo(source,lineNo,columnNo));
} catch (EvalError e3) {
throw new BSFException("BeanShell script error: " + e3 + sourceInfo(source,lineNo,columnNo));
}
}