code: private Object evalSource(Object source, ScriptContext scriptContext) throws ScriptException {
          try {
              Interpreter bsh = getInterpreter();
              NameSpace contextNameSpace = getEngineNameSpace(scriptContext);
              bsh.setNameSpace(contextNameSpace);
  
              bsh.setOut(toPrintStream(scriptContext.getWriter()));
              bsh.setErr(toPrintStream(scriptContext.getErrorWriter()));
  
  
              if (source instanceof Reader) {
                  return bsh.eval((Reader) source);
              } else {
                  return bsh.eval((String) source);
              }
          } catch (ParseException e) {
              // explicit parsing error
              throw new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber());
          } catch (TargetError e) {
              // The script threw an application level exception
              ScriptException se = new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber());
              se.initCause(e.getTarget());
              throw se;
          } catch (EvalError e) {
              // The script couldn't be evaluated properly
              throw new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber());
          } catch (IOException e) {
              throw new ScriptException(e.toString());
          }
      }
docs: /*
  This is the primary implementation method.
  We respect the String/Reader difference here in BeanShell because
  BeanShell will do a few extra things in the string case... e.g.
  tack on a trailing ";" semicolon if necessary.