Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 823930c6a -> ac741fd0d
  refs/heads/camel-2.17.x 0570a2aa6 -> 8e7206342
  refs/heads/master 3d0d0afc7 -> e9d255146


CAMEL-9549 - Improvement of error messages when compiling the schema


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/75906e3f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/75906e3f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/75906e3f

Branch: refs/heads/master
Commit: 75906e3fc30a6748df58ac5712a7a248cd0f2a84
Parents: 3d0d0af
Author: syakimovich <s0yakimov...@gmail.com>
Authored: Sun Apr 3 14:25:01 2016 +0300
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Mon Apr 4 08:26:22 2016 +0200

----------------------------------------------------------------------
 .../component/schematron/SchematronEndpoint.java      | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/75906e3f/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronEndpoint.java
 
b/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronEndpoint.java
index ccd6bea..0a78f9f 100644
--- 
a/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronEndpoint.java
+++ 
b/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronEndpoint.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.schematron;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.InputStream;
 import javax.xml.transform.Templates;
 import javax.xml.transform.TransformerFactory;
@@ -129,11 +130,16 @@ public class SchematronEndpoint extends DefaultEndpoint {
                 LOG.debug("Reading schematron rules from class path {}", path);
                 InputStream schRules = 
ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext(), path);
                 rules = TemplatesFactory.newInstance().getTemplates(schRules, 
transformerFactory);
-            } catch (Exception e) {
+            } catch (Exception classPathException) {
                 // 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);
+                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.
+                }
             }
 
             // rules not found in class path nor in file system.

Reply via email to