camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/6] camel git commit: CAMEL-9549 - Improvement of error messages when compiling the schema
Date Mon, 04 Apr 2016 06:30:56 GMT
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/dc3bb68f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dc3bb68f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dc3bb68f

Branch: refs/heads/camel-2.16.x
Commit: dc3bb68f7c1f959b3a895a98e013b8d098563382
Parents: 823930c
Author: syakimovich <s0yakimovich@gmail.com>
Authored: Sun Apr 3 14:25:01 2016 +0300
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Apr 4 08:30:37 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/camel/blob/dc3bb68f/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 bc63b8e..25e2760 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().getClassResolver(),
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.


Mime
View raw message