Package org.apache.commons.jelly

Examples of org.apache.commons.jelly.JellyException


        getJellyContext().setVariable("test.invokeThatDoesNotHandleException",Boolean.TRUE);
        script.run(getJellyContext(),getXMLOutput());
        String exceptionMessage = (String) getJellyContext().getVariable("exceptionMessage");
        assertNotNull( exceptionMessage );
        assertNotNull( getJellyContext().getVariable("exceptionBean"));
        JellyException jellyException = (JellyException) getJellyContext().getVariable("jellyException");
        assertNotNull( jellyException );
        assertTrue( "messages are the same", ! exceptionMessage.equals(jellyException.getMessage()) );
        assertTrue( "exception '" + jellyException.getMessage() + "' does not ends with '" +
                exceptionMessage+"'", jellyException.getMessage().endsWith(exceptionMessage) );
        assertNotNull( jellyException.getCause() );
        assertEquals( exceptionMessage, jellyException.getCause().getMessage() );
    }
View Full Code Here


        Script script = getJelly().compileScript();
        getJellyContext().setVariable("test.invokeThatDoesNotHandleException",Boolean.TRUE);
        script.run(getJellyContext(),getXMLOutput());
        String exceptionMessage = (String) getJellyContext().getVariable("exceptionMessage");
        assertNotNull( exceptionMessage );
        JellyException jellyException = (JellyException) getJellyContext().getVariable("jellyException");
        assertNotNull( jellyException );
        assertTrue( "messages are the same", ! exceptionMessage.equals(jellyException.getMessage()) );
        assertTrue( "exception '" + jellyException.getMessage() + "' does not ends with '" +
                exceptionMessage+"'", jellyException.getMessage().endsWith(exceptionMessage) );
        assertNotNull( jellyException.getCause() );
        assertEquals( exceptionMessage, jellyException.getCause().getMessage() );
    }
View Full Code Here

        {
            expression = new JexlExpression( org.apache.commons.jexl.ExpressionFactory.createExpression( text ) );
        }
        catch ( Exception anException )
        {
            throw new JellyException( "error evaluating expression", anException );
        }

        final Expression jexlExpression = expression;

        if ( isSupportAntVariables() && isValidAntVariableName( text ) )
View Full Code Here

        Throwable localThrowable = t;
        while ( localThrowable != null )
        {
            if ( localThrowable instanceof JellyException )
            {
                JellyException jellyEx = (JellyException) localThrowable;
                if ( jellyEx.getCause() == null )
                {
                    LOGGER.info( MavenUtils.getMessage( "exception.cause" ) + jellyEx.getReason() );
                }
                if ( displayStackTrace )
                {
                    LOGGER.info( MavenUtils.getMessage( "build.jellyException.file", jellyEx.getFileName() ) );
                    LOGGER.info( MavenUtils.getMessage( "build.jellyException.element", jellyEx.getElementName() ) );
                    LOGGER.info( MavenUtils.getMessage( "build.jellyException.line",
                                                        Integer.toString( jellyEx.getLineNumber() ) ) );
                    LOGGER.info( MavenUtils.getMessage( "build.jellyException.column",
                                                        Integer.toString( jellyEx.getColumnNumber() ) ) );
                }
            }
            else if ( localThrowable.getLocalizedMessage() != null )
                LOGGER.info( MavenUtils.getMessage( "exception.cause" ) + localThrowable.getLocalizedMessage() );
            else
View Full Code Here

            // this method really does throw Exception
            jexlExpression = new JexlExpression(
            org.apache.commons.jexl.ExpressionFactory.createExpression(text)
            );
        } catch (Exception e) {
            throw new JellyException("Unable to create expression: " + text, e);
        }

        if ( isSupportAntVariables() && isValidAntVariableName(text) ) {
            return new ExpressionSupportLocal(jexlExpression,text);
        }
View Full Code Here

                    String name = (String) entry.getKey();
                    Expression expression = (Expression) entry.getValue();

                    DynaProperty property = dynaBean.getDynaClass().getDynaProperty(name);
                    if (property == null) {
                        throw new JellyException("This tag does not understand the '" + name + "' attribute" );
                    }
                    Class type = property.getType();

                    Object value = null;
                    if (type.isAssignableFrom(Expression.class) && !type.isAssignableFrom(Object.class)) {
View Full Code Here

    /**
     * Creates a new Jelly exception, adorning it with location information
     */
    protected JellyException createJellyException(String reason) {
        return new JellyException(
            reason, fileName, elementName, columnNumber, lineNumber
        );
    }
View Full Code Here

        if (cause instanceof JellyException) {
            return (JellyException) cause;
        }

        if (cause instanceof InvocationTargetException) {
            return new JellyException(
                reason,
                ((InvocationTargetException) cause).getTargetException(),
                fileName,
                elementName,
                columnNumber,
                lineNumber);
        }
        return new JellyException(
            reason, cause, fileName, elementName, columnNumber, lineNumber
        );
    }
View Full Code Here

        Script script = getJelly().compileScript();
        getJellyContext().setVariable("test.invokeThatDoesNotHandleException",Boolean.TRUE);
        script.run(getJellyContext(),getXMLOutput());
        String exceptionMessage = (String) getJellyContext().getVariable("exceptionMessage");
        assertNotNull( exceptionMessage );
        JellyException jellyException = (JellyException) getJellyContext().getVariable("jellyException");
        assertNotNull( jellyException );
        assertTrue( "messages are the same", ! exceptionMessage.equals(jellyException.getMessage()) );
        assertTrue( "exception '" + jellyException.getMessage() + "' does not ends with '" +
                exceptionMessage+"'", jellyException.getMessage().endsWith(exceptionMessage) );
        assertNotNull( jellyException.getCause() );
        assertEquals( exceptionMessage, jellyException.getCause().getMessage() );
    }
View Full Code Here

        getJellyContext().setVariable("test.invokeThatDoesNotHandleException",Boolean.TRUE);
        script.run(getJellyContext(),getXMLOutput());
        String exceptionMessage = (String) getJellyContext().getVariable("exceptionMessage");
        assertNotNull( exceptionMessage );
        assertNotNull( getJellyContext().getVariable("exceptionBean"));
        JellyException jellyException = (JellyException) getJellyContext().getVariable("jellyException");
        assertNotNull( jellyException );
        assertTrue( "messages are the same", ! exceptionMessage.equals(jellyException.getMessage()) );
        assertTrue( "exception '" + jellyException.getMessage() + "' does not ends with '" +
                exceptionMessage+"'", jellyException.getMessage().endsWith(exceptionMessage) );
        assertNotNull( jellyException.getCause() );
        assertEquals( exceptionMessage, jellyException.getCause().getMessage() );
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jelly.JellyException

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.