Package org.mozilla.javascript

Examples of org.mozilla.javascript.EvaluatorException


        if (pos < args.length) {
            if (args[pos] instanceof Function) {
                return (Function)args[pos];
            } else {
                if (required) {
                    throw new EvaluatorException("Function expected");
                } else {
                    return null;
                }
            }
        } else {
View Full Code Here


                    if(type.isInstance(arg)) {
                        return type.cast(arg);
                    }
                }
                if (required) {
                    throw new EvaluatorException("Object of type " + type + " expected");
                } else {
                    return null;
                }
            }
        } else {
View Full Code Here

    {
        try {
            return nativeModule.internalRequire(modName, cx);
        } catch (InvocationTargetException e) {
            Throwable targetException = e.getTargetException();
            throw new EvaluatorException("Error initializing module: " +
                    ((targetException != null) ?
                            e.toString() + ": " + targetException.toString() :
                            e.toString()));
        } catch (InstantiationException e) {
            throw new EvaluatorException("Error initializing module: " + e.toString());
        } catch (IllegalAccessException e) {
            throw new EvaluatorException("Error initializing modugle: " + e.toString());
        }
    }
View Full Code Here

      return prototype;
    return Scriptable.NOT_FOUND;
  }

  public void put(String name, Scriptable start, Object value) {
    EvaluatorException error = null;
    if (members.has(name, false)) {
      try {
        // Try setting the value on member first
        members.put(this, name, javaObject, value, false);
        if (changeReceiver != null)
View Full Code Here

    if (thisObj instanceof ScriptableObject) {
      ScriptableObject obj = (ScriptableObject) thisObj;
      for (int i = 0; i < args.length; i++) {
        if (!(args[i] instanceof String)) {
          throw new EvaluatorException(
              "dontEnum() called with non-String argument");
        }
        String str = (String) args[i];
        if (obj.has(str, obj)) {
          int attr = obj.getAttributes(str);
View Full Code Here

                                }

                                public EvaluatorException runtimeError(String message, String sourceName,
                                        int line, String lineSource, int lineOffset) {
                                    error(message, sourceName, line, lineSource, lineOffset);
                                    return new EvaluatorException(message);
                                }
                            });

                            // Close the input stream first, and then open the output stream,
                            // in case the output file should override the input file.
View Full Code Here

            if (callFun == Scriptable.NOT_FOUND) {
                callFun = "callFunction"; // this will produce a better error message
            }
            ScriptRuntime.call(context, callFun, thrScope, callFunArgs, thrScope);
        } catch (JavaScriptException ex) {
            EvaluatorException ee =
                Context.reportRuntimeError(ToolErrorReporter.getMessage("msg.uncaughtJSException",
                                                                        ex.getMessage()));
            Throwable unwrapped = unwrap(ex);
            if (unwrapped instanceof ProcessingException) {
                throw (ProcessingException)unwrapped;
            }

            throw new CascadingRuntimeException(ee.getMessage(), unwrapped);
        } catch (EcmaError ee) {
            String msg = ToolErrorReporter.getMessage("msg.uncaughtJSException", ee.toString());
            if (ee.getSourceName() != null) {
                Context.reportRuntimeError(msg,
                                           ee.getSourceName(),
                                           ee.getLineNumber(),
                                           ee.getLineSource(),
                                           ee.getColumnNumber());
            } else {
                Context.reportRuntimeError(msg);
            }
            throw new CascadingRuntimeException(ee.getMessage(), ee);
        } finally {
            exitContext(thrScope);
        }
    }
View Full Code Here

        cocoon.setParameters(parameters);

        try {
            ((Function)handleContFunction).call(context, kScope, kScope, args);
        } catch (JavaScriptException ex) {
            EvaluatorException ee =
                Context.reportRuntimeError(ToolErrorReporter.getMessage("msg.uncaughtJSException",
                                                                        ex.getMessage()));
            Throwable unwrapped = unwrap(ex);
            if (unwrapped instanceof ProcessingException) {
                throw (ProcessingException)unwrapped;
            }

            throw new CascadingRuntimeException(ee.getMessage(), unwrapped);
        } catch (EcmaError ee) {
            String msg = ToolErrorReporter.getMessage("msg.uncaughtJSException", ee.toString());
            if (ee.getSourceName() != null) {
                Context.reportRuntimeError(msg,
                                           ee.getSourceName(),
                                           ee.getLineNumber(),
                                           ee.getLineSource(),
                                           ee.getColumnNumber());
            } else {
                Context.reportRuntimeError(msg);
            }
            throw new CascadingRuntimeException(ee.getMessage(), ee);
        } finally {
            Context.exit();
        }
    }
View Full Code Here

  {
      String errMsg = getErrorMessage("msg.error", message,
                                      sourceName, line,
                                      lineSrc, column);
      System.err.println(errMsg);
      return new EvaluatorException(errMsg);
  }
View Full Code Here

         
            cx = Context.enter();
            Object func = scope.get(methodName, scope);
           
            if (func == null || !(func instanceof Function)) {
                throw new EvaluatorException("Function " + methodName
                          + " not found");
            }
           
            cx.setGeneratingDebug(false);
            cx.setGeneratingSource(false);
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.EvaluatorException

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.