Package org.thymeleaf.exceptions

Examples of org.thymeleaf.exceptions.TemplateInputException


                return StandardDOMTranslator.translateDocument(domDocument, documentName, templateReader.getDocTypeClause());

            } catch (final TemplateProcessingException e) {
                throw e;
            } catch (final Exception e) {
                throw new TemplateInputException("Exception parsing document", e);
            } finally {

                if (templateReader != null) {
                    try {
                        templateReader.close();
View Full Code Here


        try {
           
            return parser.parseTemplate(configuration, "input", source);
           
        } catch (final Exception e) {
            throw new TemplateInputException(
                    "Exception during parsing of source", e);
        }
       
    }
View Full Code Here

                return StandardDOMTranslator.translateDocument(domDocument, documentName, templateReader.getDocTypeClause());
               
            } catch (final TemplateProcessingException e) {
                throw e;
            } catch (final Exception e) {
                throw new TemplateInputException("Exception parsing document", e);
            } finally {

                if (templateReader != null) {
                    try {
                        templateReader.close();
View Full Code Here

        }
        final Properties properties = new Properties();
        try {
            properties.load(propertiesIS);
        } catch (final Exception e) {
            throw new TemplateInputException("Exception loading messages file", e);
        } finally {
            try {
                propertiesIS.close();
            } catch (final Exception e) {
                // ignored
View Full Code Here

            }
               
            return result;
       
        } catch (final Exception ignored) {
            throw new TemplateInputException("DOCTYPE clause has bad format: \"" + docTypeClause + "\"");
        }
       
    }
View Full Code Here

            }
           
            return document;
           
        } catch (final IOException e) {
            throw new TemplateInputException("Exception parsing document", e);
        } catch (final TemplateProcessingException e) {
            throw e;
        } catch (final SAXParseException e) {
            final String message =
                    String.format("Exception parsing document: template=\"%s\", line %d - column %d",
                            documentName, Integer.valueOf(e.getLineNumber()), Integer.valueOf(e.getColumnNumber()));
            throw new TemplateInputException(message, e);
        } catch (final SAXException e) {
            throw new TemplateInputException("Exception parsing document", e);
        } finally {

            if (templateReader != null) {
                try {
                    templateReader.close();
View Full Code Here

                copyToResult(
                        this.buffer, buffi, toBeOverFlowed,
                        cbuf, cbufi, last);
            // copied must be zero
            if (copied != 0) {
                throw new TemplateInputException("Overflow was not correctly computed!");
            }
        }
       
       
        if (overflowOverflow != null) {
           
            final int copied =
                copyToResult(
                        overflowOverflow, 0, overflowOverflow.length,
                        cbuf, cbufi, last);
           
            // copied must be zero
            if (copied != 0) {
                throw new TemplateInputException("Overflow-overflow was not correctly computed!");
            }
           
        }

View Full Code Here

   
           
            return result;

        } catch (final Exception e) {
            throw new TemplateInputException("DOCTYPE clause has bad format: \"" + (new String(buffer, offset, len)) + "\"", e);
        }
       
    }
View Full Code Here

                }
           
        }
       
        if (templateResolution == null || templateInputStream == null) {
            throw new TemplateInputException(
                    "Error resolving template \"" + templateProcessingParameters.getTemplateName() + "\", " +
                    "template might not exist or might not be accessible by " +
                    "any of the configured Template Resolvers");
        }

       
        final String templateMode = templateResolution.getTemplateMode();
       
        final ITemplateParser templateParser = this.parsersByTemplateMode.get(templateMode);
        if (templateParser == null) {
            throw new TemplateInputException(
                    "Template mode \"" + templateMode + "\" has not been configured");
        }
       
        if (logger.isTraceEnabled()) {
            logger.trace("[THYMELEAF][{}] Starting parsing of template \"{}\"", TemplateEngine.threadIndex(), templateName);
        }
       
       
        final String characterEncoding = templateResolution.getCharacterEncoding();
        Reader reader = null;
        if (!StringUtils.isEmptyOrWhitespace(characterEncoding)) {
            try {
                reader = new InputStreamReader(templateInputStream, characterEncoding);
            } catch (final UnsupportedEncodingException e) {
                throw new TemplateInputException("Exception parsing document", e);
            }
        } else {
            reader = new InputStreamReader(templateInputStream);
        }
       
View Full Code Here

           
        } catch (final SAXException e) {
           
            if(e.getMessage() != null &&
                e.getMessage().contains(SAXPARSEEXCEPTION_BAD_ELEMENT_CONTENT)) {
                throw new TemplateInputException(
                    SAXPARSEEXCEPTION_BAD_ELEMENT_CONTENT_EXPLANATION, e);
            }
           
            throw new TemplateInputException("An exception happened during parsing", e);
           
        } catch (final IOException e) {
           
            throw new TemplateInputException("Exception parsing document", e);
           
        } catch (final TemplateProcessingException e) {
           
            throw e;
           
        } catch (final Exception e) {
           
            throw new TemplateInputException("Exception parsing document", e);
           
        } finally {

            if (templateReader != null) {
                try {
View Full Code Here

TOP

Related Classes of org.thymeleaf.exceptions.TemplateInputException

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.