Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ussy/1956354 to your computer and use it in GitHub Desktop.
Save ussy/1956354 to your computer and use it in GitHub Desktop.
include the line number in the error message for Thymeleaf
--- AbstractNonValidatingSAXTemplateParser.java 2012-03-02 15:43:16.000000000 +0900
+++ AbstractNonValidatingSAXTemplateParser.java 2012-03-02 15:42:53.000000000 +0900
@@ -123,6 +123,9 @@
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, near line=%d, column=%d", documentName, e.getLineNumber(), e.getColumnNumber());
+ throw new TemplateInputException(message, e);
} catch (final SAXException e) {
throw new TemplateInputException("Exception parsing document", e);
} finally {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment