Examples of JavaScriptException


Examples of org.mozilla.javascript.JavaScriptException

        throws JavaScriptException
    {
        try {
            environment.redirect(false,uri);
        } catch (Exception e) {
            throw new JavaScriptException(e);
        }
    }
View Full Code Here

Examples of org.mozilla.javascript.JavaScriptException

  protected int evalInt(String script) {
    Object o = eval(script);
    if (o instanceof Number) {
      return ((Number) o).intValue();
    }
    throw new JavaScriptException(null, "invalid return type "
        + o.getClass().getName() + " with value " + o, 0);
  }
View Full Code Here

Examples of org.mozilla.javascript.JavaScriptException

  protected long evalLong(String script) {
    Object o = eval(script);
    if (o instanceof Number) {
      return ((Number) o).longValue();
    }
    throw new JavaScriptException(null, "invalid return type "
        + o.getClass().getName() + " with value " + o, 0);
  }
View Full Code Here

Examples of org.mozilla.javascript.JavaScriptException

  protected boolean evalBoolean(String script) {
    Object o = eval(script);
    if (o instanceof Boolean) {
      return ((Boolean) o).booleanValue();
    }
    throw new JavaScriptException(null, "invalid return type "
        + o.getClass().getName() + " with value " + o, 0);
  }
View Full Code Here

Examples of org.mozilla.javascript.JavaScriptException

        Function function = (Function)fObj;
        try {
            return function.call(rhinoContext, rhinoScope, rhinoScope, args);
        } catch (RhinoException angryRhino) {
            if (expectingException != null && angryRhino instanceof JavaScriptException) {
                JavaScriptException jse = (JavaScriptException)angryRhino;
                Assert.assertEquals(jse.getValue(), expectingException);
                return null;
            }
            String trace = angryRhino.getScriptStackTrace();
            Assert.fail("JavaScript error: " + angryRhino.toString() + " " + trace);
        } catch (JavaScriptAssertionFailed assertion) {
View Full Code Here

Examples of org.mozilla.javascript.JavaScriptException

    public void jsFunction_processPipelineTo(String uri,
                                             Object map,
                                             Object outputStream)
        throws Exception {
        if (!(unwrap(outputStream) instanceof OutputStream)) {
            throw new JavaScriptException("expected a java.io.OutputStream instead of " + outputStream);
        }
        interpreter.process(getParentScope(), this, uri, map,
                            (OutputStream)unwrap(outputStream),
                            environment);
    }
View Full Code Here

Examples of org.mozilla.javascript.JavaScriptException

     */
    public void jsFunction_releaseComponent( Object component ) throws Exception {
        try {
            this.componentManager.release( (Component) unwrap(component) );
        } catch( ClassCastException cce ) {
            throw new JavaScriptException( "Only components can be released!" );
        }
    }
View Full Code Here

Examples of org.mozilla.javascript.JavaScriptException

        }

        public void jsFunction_addCookie(Object cookie)
            throws JavaScriptException {
            if (!(cookie instanceof FOM_Cookie)) {
                throw new JavaScriptException("expected a Cookie instead of " + cookie);
            }
            FOM_Cookie fom_cookie = (FOM_Cookie)cookie;
            response.addCookie(fom_cookie.cookie);
        }
View Full Code Here

Examples of org.mozilla.javascript.JavaScriptException

        public void put(String name, Scriptable start, Object value) {
            //Allow setting values to existing variables, or if this is a
            //java class (used by importClass & importPackage)
            if (this.locked && !has(name, start) && !(value instanceof NativeJavaClass)) {
                // Need to wrap into a runtime exception as Scriptable.put has no throws clause...
                throw new WrappedException (new JavaScriptException("Implicit declaration of global variable '" + name +
                  "' forbidden. Please ensure all variables are explicitely declared with the 'var' keyword"));
            }
            this.useSession = true;
            super.put(name, start, value);
        }
View Full Code Here

Examples of org.mozilla.javascript.JavaScriptException

        }

        public void put(int index, Scriptable start, Object value) {
            // FIXME(SW): do indexed properties have a meaning on the global scope?
            if (this.locked && !has(index, start)) {
                throw new WrappedException(new JavaScriptException("Global scope locked. Cannot set value for index " + index));
            }
            this.useSession = true;
            super.put(index, start, value);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.