Package org.apache.velocity.exception

Examples of org.apache.velocity.exception.ParseErrorException


    public boolean render(InternalContextAdapter adapter, Writer writer, Node node) throws IOException, ResourceNotFoundException,
            ParseErrorException, MethodInvocationException {
        ApplyDecoratorDirective.DirectiveStack stack = (ApplyDecoratorDirective.DirectiveStack) adapter
                .get(ApplyDecoratorDirective.STACK_KEY);
        if (stack == null)
            throw new ParseErrorException("#decoratorParam error: You must nest this directive within a #applyDecorator directive");
        ApplyDecoratorDirective parent = stack.peek();
        if (parent == null) {
            log.error("#decoratorParam error: You must nest this directive within a #applyDecorator directive");
            return false;
        } else {
View Full Code Here


            br = new BufferedReader(new InputStreamReader(instream, encoding));
        }
        catch (UnsupportedEncodingException uce) {
            String msg = "Unsupported input encoding : " + encoding
                + " for template " + logTag;
            throw new ParseErrorException(msg);
        }

        return evaluate(context, writer, logTag, br);
    }
View Full Code Here

        try {
            nodeTree = ri.parse(reader, logTag);
        }
        catch (ParseException pex) {
            throw new ParseErrorException(pex);
        }
        catch (TemplateInitException pex) {
            throw new ParseErrorException(pex);
        }

        /*
         * now we want to init and render
         */

        if (nodeTree != null) {
            InternalContextAdapterImpl ica =
                new InternalContextAdapterImpl(context);

            ica.pushCurrentTemplateName(logTag);

            try {
                try {
                    nodeTree.init(ica, ri);
                }
                catch (TemplateInitException pex) {
                    throw new ParseErrorException(pex);
                }
                /**
                 * pass through application level runtime exceptions
                 */
                catch (RuntimeException e) {
View Full Code Here

        try {
            nodeTree = parse(reader, name);
        }
        catch (ParseException pex) {
            throw new ParseErrorException(pex);
        }
        catch (TemplateInitException pex) {
            throw new ParseErrorException(pex);
        }

        return new SpecialTemplate(nodeTree, this, name);
    }
View Full Code Here

            br = new BufferedReader(new InputStreamReader(instream, encoding));
        }
        catch (UnsupportedEncodingException uce) {
            String msg = "Unsupported input encoding : " + encoding
                + " for template " + logTag;
            throw new ParseErrorException(msg);
        }

        return evaluate(context, writer, logTag, br);
    }
View Full Code Here

        try {
            nodeTree = ri.parse(reader, logTag);
        }
        catch (ParseException pex) {
            throw new ParseErrorException(pex);
        }
        catch (TemplateInitException pex) {
            throw new ParseErrorException(pex);
        }

        /*
         * now we want to init and render
         */

        if (nodeTree != null) {
            InternalContextAdapterImpl ica =
                new InternalContextAdapterImpl(context);

            ica.pushCurrentTemplateName(logTag);

            try {
                try {
                    nodeTree.init(ica, ri);
                }
                catch (TemplateInitException pex) {
                    throw new ParseErrorException(pex);
                }
                /**
                 * pass through application level runtime exceptions
                 */
                catch (RuntimeException e) {
View Full Code Here

        this.servletContext = servletContext;

        isParseError = error instanceof ParseErrorException;

        if (error instanceof ParseErrorException) {
            ParseErrorException pee = (ParseErrorException) error;
            if (pee.getTemplateName().charAt(0) == '/') {
                sourceName = pee.getTemplateName();
            } else {
                sourceName =  '/' + pee.getTemplateName();
            }
            lineNumber = pee.getLineNumber();
            columnNumber = pee.getColumnNumber();

            InputStream is =
                servletContext.getResourceAsStream(sourceName);

            sourceReader = new LineNumberReader(new InputStreamReader(is));
View Full Code Here

            String property = param.substring(0, idx);

            String value = param.substring(idx + 1);
            propertyMap.put(property, value);
        } else {
            throw new ParseErrorException("#" + this.getName() + " arguments must include an assignment operator!  For example #tag( Component \"template=mytemplate\" ).  #tag( TextField \"mytemplate\" ) is illegal!");
        }
    }
View Full Code Here

        {
            nodeTree = parse(reader, logTag);
        }
        catch (ParseException pex)
        {
            throw new ParseErrorException(pex);
        }
        catch (TemplateInitException pex)
        {
            throw new ParseErrorException(pex);
        }

        if (nodeTree == null)
        {
            return false;
View Full Code Here

            {
                nodeTree.init(ica, this);
            }
            catch (TemplateInitException pex)
            {
                throw new ParseErrorException(pex);
            }
            /**
             * pass through application level runtime exceptions
             */
            catch(RuntimeException e)
View Full Code Here

TOP

Related Classes of org.apache.velocity.exception.ParseErrorException

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.