[jira] [Commented] (CAMEL-9549) camel-schematron - More fine grained error messages when compiling the schema
[ https://issues.apache.org/jira/browse/CAMEL-9549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15223727#comment-15223727 ] ASF GitHub Bot commented on CAMEL-9549: --- Github user asfgit closed the pull request at: https://github.com/apache/camel/pull/926 > camel-schematron - More fine grained error messages when compiling the schema > - > > Key: CAMEL-9549 > URL: https://issues.apache.org/jira/browse/CAMEL-9549 > Project: Camel > Issue Type: Improvement > Components: camel-schematron >Affects Versions: 2.15.3 >Reporter: Johan Mörén >Assignee: Claus Ibsen >Priority: Minor > Fix For: 2.16.4, 2.17.1, 2.18.0 > > > When pre-compiling the schematron rules files. Errors such as > xslt-compilation errors, includes not found etc. are always caught and > presented with an error message saying incorrectly that the schematron rules > file could not be found. > In the two errors above the file has been found but compilation of it has > failed. > To make troubleshooting easier i think that a more fine grained error > handling could provide the user with a better view of what the underlying > error really is. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-9549) camel-schematron - More fine grained error messages when compiling the schema
[ https://issues.apache.org/jira/browse/CAMEL-9549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15223341#comment-15223341 ] ASF GitHub Bot commented on CAMEL-9549: --- GitHub user syakimovich opened a pull request: https://github.com/apache/camel/pull/926 CAMEL-9549 - Improvement of error messages when compiling the schema You can merge this pull request into a Git repository by running: $ git pull https://github.com/syakimovich/camel CAMEL-9549 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/camel/pull/926.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #926 commit 1c2f59033eb5b71cefda80f7301136f927a42a61 Author: syakimovichDate: 2016-04-03T11:25:01Z CAMEL-9549 - Improvement of error messages when compiling the schema > camel-schematron - More fine grained error messages when compiling the schema > - > > Key: CAMEL-9549 > URL: https://issues.apache.org/jira/browse/CAMEL-9549 > Project: Camel > Issue Type: Improvement > Components: camel-schematron >Affects Versions: 2.15.3 >Reporter: Johan Mörén >Priority: Minor > > When pre-compiling the schematron rules files. Errors such as > xslt-compilation errors, includes not found etc. are always caught and > presented with an error message saying incorrectly that the schematron rules > file could not be found. > In the two errors above the file has been found but compilation of it has > failed. > To make troubleshooting easier i think that a more fine grained error > handling could provide the user with a better view of what the underlying > error really is. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-9549) camel-schematron - More fine grained error messages when compiling the schema
[ https://issues.apache.org/jira/browse/CAMEL-9549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15223294#comment-15223294 ] Claus Ibsen commented on CAMEL-9549: Yeah that seems a good idea to throw the original cause. You are welcome to work on a patch > camel-schematron - More fine grained error messages when compiling the schema > - > > Key: CAMEL-9549 > URL: https://issues.apache.org/jira/browse/CAMEL-9549 > Project: Camel > Issue Type: Improvement > Components: camel-schematron >Affects Versions: 2.15.3 >Reporter: Johan Mörén >Priority: Minor > > When pre-compiling the schematron rules files. Errors such as > xslt-compilation errors, includes not found etc. are always caught and > presented with an error message saying incorrectly that the schematron rules > file could not be found. > In the two errors above the file has been found but compilation of it has > failed. > To make troubleshooting easier i think that a more fine grained error > handling could provide the user with a better view of what the underlying > error really is. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-9549) camel-schematron - More fine grained error messages when compiling the schema
[ https://issues.apache.org/jira/browse/CAMEL-9549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15223235#comment-15223235 ] Sergey Yakimovich commented on CAMEL-9549: -- I looked into it and the wrong error is shown because of the following. Rules first searched in the classpath. If there is an exception, for example, parsing error, file system is searched and FileNotFoundException is thrown. I propose the following change. Change this: {code:title=SchematronEndpoint.java|borderStyle=solid} try { // Attempt to read the schematron rules from the class path first. LOG.debug("Reading schematron rules from class path {}", path); InputStream schRules = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext(), path); rules = TemplatesFactory.newInstance().getTemplates(schRules, transformerFactory); } catch (Exception e) { // Attempts from the file system. LOG.debug("Schamatron rules not found in class path, attempting file system {}", path); InputStream schRules = FileUtils.openInputStream(new File(path)); rules = TemplatesFactory.newInstance().getTemplates(schRules, transformerFactory); } {code} to this: {code:title=SchematronEndpoint.java|borderStyle=solid} try { // Attempt to read the schematron rules from the class path first. LOG.debug("Reading schematron rules from class path {}", path); InputStream schRules = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext(), path); rules = TemplatesFactory.newInstance().getTemplates(schRules, transformerFactory); } catch (Exception classPathException) { // Attempts from the file system. LOG.debug("Error loading schematron rules from class path, attempting file system {}", path); try{ InputStream schRules = FileUtils.openInputStream(new File(path)); rules = TemplatesFactory.newInstance().getTemplates(schRules, transformerFactory); } catch (FileNotFoundException e) { LOG.debug("Schematron rules not found in the file system {}", path); throw classPathException; // Can be more meaningful, for example, xslt compilation error. } } {code} I will create a pull request if this is ok. > camel-schematron - More fine grained error messages when compiling the schema > - > > Key: CAMEL-9549 > URL: https://issues.apache.org/jira/browse/CAMEL-9549 > Project: Camel > Issue Type: Improvement > Components: camel-schematron >Affects Versions: 2.15.3 >Reporter: Johan Mörén >Priority: Minor > > When pre-compiling the schematron rules files. Errors such as > xslt-compilation errors, includes not found etc. are always caught and > presented with an error message saying incorrectly that the schematron rules > file could not be found. > In the two errors above the file has been found but compilation of it has > failed. > To make troubleshooting easier i think that a more fine grained error > handling could provide the user with a better view of what the underlying > error really is. -- This message was sent by Atlassian JIRA (v6.3.4#6332)