Package org.jaggeryjs.scriptengine.exceptions

Examples of org.jaggeryjs.scriptengine.exceptions.ScriptException


            try {
                rho.response.sendError((Integer) args[0], (String) args[1]);
            } catch (IOException e) {
                String msg = "Error sending error. Status : " + args[0] + ", Message : " + args[1];
                log.warn(msg, e);
                throw new ScriptException(msg, e);
            }
        } else {
            try {
                rho.response.sendError((Integer) args[0]);
            } catch (IOException e) {
                String msg = "Error sending error. Status : " + args[0];
                log.warn(msg, e);
                throw new ScriptException(msg, e);
            }
        }
    }
View Full Code Here


        try {
            rho.response.sendRedirect((String) args[0]);
        } catch (IOException e) {
            String msg = "Error sending redirect : " + args[0];
            log.warn(msg, e);
            throw new ScriptException(msg, e);
        }
    }
View Full Code Here

                transformer.setURIResolver(getUriResolver(cx, scope, uriResolver));
            }
            return transformer;
        } catch (TransformerConfigurationException e) {
            log.error(e.getMessage(), e);
            throw new ScriptException(e);
        }
    }
View Full Code Here

                }
            });
            return null;
        } catch (TransformerException e) {
            log.error(e.getMessage(), e);
            throw new ScriptException(e);
        }
    }
View Full Code Here

                                           boolean inNewExpr) throws ScriptException {
        if (args.length == 1) {
            if (args[0] instanceof Collection && !(args[0] instanceof Scriptable)) {
                return new CollectionHostObject((Collection) args[0], cx);
            } else if (args[0] instanceof Scriptable) {
                throw new ScriptException("Collection object cannot be initialized directly, " +
                        "use registry.newCollection() instead");
            } else {
                throw new ScriptException("Invalid argument type for Collection constructor");
            }
        } else {
            throw new ScriptException("Invalid no. of arguments for Collection constructor");
        }
    }
View Full Code Here

        if (arguments.length == 0) {
            try {
                String[] children = ((Collection)collectionHostObject.getResource()).getChildren();
                return cx.newArray(thisObj, Arrays.copyOf(children, children.length, Object[].class));
            } catch (RegistryException e) {
                throw new ScriptException("Error occurred while creating a new Resource.", e);
            }
        } else if (arguments.length == 2) {
            if (arguments[0] instanceof Number && arguments[1] instanceof Number) {
                try {
                    String[] children = ((Collection) collectionHostObject.getResource()).getChildren(
                                                ((Number) arguments[0]).intValue(),
                                                ((Number) arguments[1]).intValue());
                    return cx.newArray(thisObj, Arrays.copyOf(children, children.length, Object[].class));
                } catch (RegistryException e) {
                    throw new ScriptException("Error occurred while creating a new Resource.", e);
                }
            } else {
                throw new ScriptException("Invalid argument types for getChildren() method");
            }
        } else {
            throw new ScriptException("Invalid no. of arguments for getChildren() method");
        }
    }
View Full Code Here

    public int jsGet_childCount() throws ScriptException {
        try {
            return ((Collection) this.getResource()).getChildCount();
        } catch (RegistryException e) {
            throw new ScriptException("Error occurred while creating a new Resource.", e);
        }
    }
View Full Code Here

    public static void jsFunction_send(Context cx, Scriptable thisObj, Object[] args, Function funObj)
            throws ScriptException {
        String functionName = "send";
        XMLHttpRequestHostObject xhr = (XMLHttpRequestHostObject) thisObj;
        if (xhr.readyState != OPENED) {
            throw new ScriptException("Invalid state, cannot invoke send() method. readyState : " + xhr.readyState);
        }
        if (xhr.sent) {
            xhr.method.abort();
            throw new ScriptException("Invalid state, cannot invoke send() method while a request is active. " +
                    "Request aborted.");
        }
        int argsCount = args.length;
        if (argsCount > 1) {
            HostObjectUtil.invalidNumberOfArgs(hostObjectName, functionName, argsCount, false);
View Full Code Here

        } else if ("TRACE".equalsIgnoreCase(methodName)) {
            method = new TraceMethod(this.url);
        } else if ("OPTIONS".equalsIgnoreCase(methodName)) {
            method = new OptionsMethod(this.url);
        } else {
            throw new ScriptException("Unknown HTTP method : " + methodName);
        }
        for (Header header : requestHeaders) {
            method.addRequestHeader(header);
        }
        if (username != null) {
View Full Code Here

                xhr.responseType = contentType.getValue();
            }
            updateReadyState(cx, xhr, DONE);
        } catch (IOException e) {
            log.error(e.getMessage(), e);
            throw new ScriptException(e);
        } finally {
            xhr.method.releaseConnection();
        }
    }
View Full Code Here

TOP

Related Classes of org.jaggeryjs.scriptengine.exceptions.ScriptException

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.