Package org.apache.commons.jelly

Examples of org.apache.commons.jelly.JellyException


    // Tag interface
    //-------------------------------------------------------------------------
    public void doTag(XMLOutput output) throws Exception {
        ResultSetTag tag = (ResultSetTag) findAncestorWithClass( ResultSetTag.class );
        if ( tag == null ) {
            throw new JellyException( "This tag must be nested with in a <resultSet> tag" );
        }
        tag.addRow( getAttributes() );
    }
View Full Code Here


    public void doTag(XMLOutput output) throws Exception {
        try {
            conn = getConnection();
        }
        catch (SQLException e) {
            throw new JellyException(sql + ": " + e.getMessage(), e);
        }

        /*
         * Use the SQL statement specified by the sql attribute, if any,
         * otherwise use the body as the statement.
         */
        String sqlStatement = null;
        if (sql != null) {
            sqlStatement = sql;
        }
        else {
            sqlStatement = getBodyText();
        }
        if (sqlStatement == null || sqlStatement.trim().length() == 0) {
            throw new JellyException(Resources.getMessage("SQL_NO_STATEMENT"));
        }

        int result = 0;
        try {
            if ( hasParameters() ) {
                PreparedStatement ps = conn.prepareStatement(sqlStatement);
                setParameters(ps);
                result = ps.executeUpdate();
            }
            else {
                Statement statement = conn.createStatement();
                result = statement.executeUpdate(sqlStatement);
            }
            if (var != null) {
                context.setVariable(var, new Integer(result));
            }
        }
        catch (SQLException e) {
            throw new JellyException(sqlStatement + ": " + e.getMessage(), e);
        }
        finally {
            if (conn != null && !isPartOfTransaction) {
                try {
                    conn.close();
View Full Code Here

        }

        int endIndex = text.indexOf( "}", startIndex+2 );

        if ( endIndex < 0 ) {
            throw new JellyException( "Missing '}' character at the end of expression: " + text );
        }
        if ( startIndex == 0 && endIndex == len - 1 ) {
            return factory.createExpression(text.substring(2, endIndex));
        }
View Full Code Here

            throw e;
        }

        if ( e instanceof InvocationTargetException)
        {
            throw new JellyException( ((InvocationTargetException)e).getTargetException(),
                                      fileName,
                                      elementName,
                                      columnNumber,
                                      lineNumber );
        }

        throw new JellyException(e, fileName, elementName, columnNumber, lineNumber);           
    }
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

            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

                {
                    throw (Exception) inner;
                }
                else
                {
                    throw new JellyException( inner );
                }
            }
        }
    }
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

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.