Package org.apache.bsf

Examples of org.apache.bsf.BSFException


    public Object eval(String source, int lineNo, int columnNo, Object script) throws BSFException {
        try {
            source = convertToValidJavaClassname(source);
            return getEvalShell().evaluate(script.toString(), source);
        } catch (Exception e) {
            throw new BSFException(BSFException.REASON_EXECUTION_ERROR, "exception from Groovy: " + e, e);
        }
    }
View Full Code Here


        try {
            // use evaluate to pass in the BSF variables
            source = convertToValidJavaClassname(source);
            getEvalShell().evaluate(script.toString(), source);
        } catch (Exception e) {
            throw new BSFException(BSFException.REASON_EXECUTION_ERROR, "exception from Groovy: " + e, e);
        }
    }
View Full Code Here

            //can't cache the script because the context may be different.
            //but don't bother loading parsing the class again
            Script s = InvokerHelper.createScript(scriptClass, context);
            return s.run();
        } catch (Exception e) {
            throw new BSFException(BSFException.REASON_EXECUTION_ERROR, "exception from Groovy: " + e, e);
        }
    }
View Full Code Here

                LOG.fine("exec() - Using cached version of class...");
            }
            InvokerHelper.invokeMethod(scriptClass, "main", EMPTY_ARGS);
        } catch (Exception e) {
            LOG.log(Level.WARNING, "BSF trace", e);
            throw new BSFException(BSFException.REASON_EXECUTION_ERROR, "exception from Groovy: " + e, e);
        }
    }
View Full Code Here

    public Object eval(String file, int line, int col, Object expr) throws BSFException {
        try {
            return JavaEmbedUtils.rubyToJava(evaler.parse(runtime, expr.toString(), file, line).run());
        } catch (Exception excptn) {
            throw new BSFException(BSFException.REASON_EXECUTION_ERROR, "Exception", excptn);
        }
    }
View Full Code Here

    @Override
    public void exec(String file, int line, int col, Object expr) throws BSFException {
        try {
            evaler.parse(runtime, expr.toString(), file, line).run();
        } catch (Exception excptn) {
            throw new BSFException(BSFException.REASON_EXECUTION_ERROR, "Exception", excptn);
        }
    }
View Full Code Here

    public Object call(Object recv, String method, Object[] args) throws BSFException {
        try {
          return JavaEmbedUtils.invokeMethod(runtime, recv, method, args, Object.class);
        } catch (Exception excptn) {
            throw new BSFException(BSFException.REASON_EXECUTION_ERROR, excptn.getMessage(), excptn);
        }
    }
View Full Code Here

        if(obj.isFunction() || obj.isUserdata() || obj.isTable())
          obj.call(new Object[] {});
      }
      catch(LuaException e)
      {
        throw new BSFException(e.getMessage());
      }
    }
  }
View Full Code Here

        L.pop(1);
        return obj;
      }
      catch (LuaException e)
      {
        throw new BSFException("Couldn't eval source code at line " + lineNo + " and column " + columnNo);
      }
    }
   
    else if (expr instanceof LuaObject)
    {
      LuaObject obj = (LuaObject) expr;
      try
      {
        if(obj.isFunction() || obj.isUserdata() || obj.isTable())
          return obj.call(new Object[] {});
      }
      catch(LuaException e)
      {
        throw new BSFException("Couldn't eval source code at line " + lineNo + " and column " + columnNo);
      }
    }
   
    return null;
  }
View Full Code Here

    {
      L.pushObjectValue(bean.bean);
    }
    catch (LuaException e)
    {
      throw new BSFException(e.getMessage());
    }
    L.setGlobal(bean.name);
  }
View Full Code Here

TOP

Related Classes of org.apache.bsf.BSFException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.