Package javax.script

Examples of javax.script.ScriptException


                return InvokerHelper.invokeMethod(thiz, name, args);
            }
        } catch (MissingMethodException mme) {
            throw new NoSuchMethodException(mme.getMessage());
        } catch (Exception e) {
            throw new ScriptException(e);
        }
        return callGlobal(name, args);
    }
View Full Code Here


        try {
            while ((numChars = reader.read(arr, 0, arr.length)) > 0) {
                buf.append(arr, 0, numChars);
            }
        } catch (IOException exp) {
            throw new ScriptException(exp);
        }
        return buf.toString();
    }
View Full Code Here

import junit.framework.TestCase;

public class ScriptExceptionTest extends TestCase {

    public void testException1(){
        ScriptException ex = new ScriptException("");
        try {
            throw ex;
        } catch (ScriptException e) {
            assertEquals(-1, e.getLineNumber());
            assertEquals(-1, e.getColumnNumber());
View Full Code Here

            assertNull(e.getFileName()); // this is not defined by the spec. or the Java 6 API
        }
    }

    public void testException2(){
        ScriptException ex = new ScriptException(new Exception());
        try {
            throw ex;
        } catch (ScriptException e) {
            assertEquals(-1, e.getLineNumber());
            assertEquals(-1, e.getColumnNumber());
View Full Code Here

        }
    }

    public void testException3(){
        final String fileName = "file";
        ScriptException ex = new ScriptException("test", fileName, 10);
        try {
            throw ex;
        } catch (ScriptException e) {
            assertEquals(10, e.getLineNumber());
            assertEquals(-1, e.getColumnNumber());
View Full Code Here

        }
    }

    public void testException4(){
        final String fileName = "file";
        ScriptException ex = new ScriptException("test", fileName, 10, 30);
        try {
            throw ex;
        } catch (ScriptException e) {
            assertEquals(10, e.getLineNumber());
            assertEquals(30, e.getColumnNumber());
View Full Code Here

    }

    public void testBSF29(){
        final Exception exception = new Exception("exception message");
        final String expectedMessage =exception.toString();
        final Exception scriptException = new ScriptException(exception);
        assertEquals(expectedMessage, scriptException.getMessage());
    }
View Full Code Here

        try {
            while(reader.read(cbuf) != -1){
                sb.append(cbuf);
            }
        } catch (IOException e) {
            throw new ScriptException(e);
        }
        return sb.toString();
    }
View Full Code Here

        try {
            StAXOMBuilder builder = new StAXOMBuilder(xmlObject.newInputStream());
            return builder.getDocumentElement();

        } catch (XMLStreamException e) {
            throw new ScriptException(e);
        }
    }
View Full Code Here

            XmlObject xml = null;
            try {
                xml = XmlObject.Factory.parse(om.getXMLStreamReader());
            } catch (Exception e) {
                throw new ScriptException(e);
            }
            Object wrappedXML = cx.getWrapFactory().wrap(cx, scope, xml, XmlObject.class);
            return cx.newObject(scope, "XML", new Object[]{wrappedXML});

        } finally {
View Full Code Here

TOP

Related Classes of javax.script.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.