Package org.mozilla.javascript

Examples of org.mozilla.javascript.JavaScriptException


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


  static class IteratorNextFunction extends PersevereNativeFunction{
    @Override
    public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
      Object item = ((IteratorObject)thisObj).queryIterator.next();
      if(item == null)
              throw new JavaScriptException(
                      NativeIterator.getStopIterationObject(scope), null, 0);
      return item;
    }
View Full Code Here

              public Object next() {
                if(next == null)
                  getNext();
                if(next == Scriptable.NOT_FOUND)
                        throw new JavaScriptException(
                                NativeIterator.getStopIterationObject(scope), null, 0);

                Object value = next;
                next = null;
                return value;
View Full Code Here

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

        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) && !(value instanceof Function)) {
                // 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

        }

        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

        }
    }

    private void throwError(String errorName) {
        LOG.info("Javascript throw: " + errorName);
        throw new JavaScriptException(Context.javaToJS(errorName, getParentScope()), "XMLHttpRequest", 0);
    }
View Full Code Here

        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

                        public Object run() throws JavaScriptException {
                            return script.exec(cx, scope);
                        }
                    }, acc );
        } catch (Exception e) {
            throw new JavaScriptException(e);
        }

    }
View Full Code Here

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

TOP

Related Classes of org.mozilla.javascript.JavaScriptException

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.