}
}
public static Object runBshAtLocation(String location, Map<String, ? extends Object> context) throws GeneralException {
try {
Interpreter interpreter = makeInterpreter(context);
Interpreter.ParsedScript script = null;
script = parsedScripts.get(location);
if (script == null) {
synchronized (OfbizBshBsfEngine.class) {
script = parsedScripts.get(location);
if (script == null) {
URL scriptUrl = FlexibleLocation.resolveLocation(location);
if (scriptUrl == null) {
throw new GeneralException("Could not find bsh script at [" + location + "]");
}
Reader scriptReader = new InputStreamReader(scriptUrl.openStream());
script = interpreter.parseScript(location, scriptReader);
if (Debug.verboseOn()) Debug.logVerbose("Caching BSH script at: " + location, module);
parsedScripts.put(location, script);
}
}
}
return interpreter.evalParsedScript(script);
} catch (MalformedURLException e) {
String errMsg = "Error loading BSH script at [" + location + "]: " + e.toString();
Debug.logError(e, errMsg, module);
throw new GeneralException(errMsg, e);
} catch (ParseException e) {