Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CAA59180A6 for ; Mon, 4 Apr 2016 06:30:52 +0000 (UTC) Received: (qmail 84609 invoked by uid 500); 4 Apr 2016 06:30:52 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 84462 invoked by uid 500); 4 Apr 2016 06:30:52 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 84276 invoked by uid 99); 4 Apr 2016 06:30:52 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Apr 2016 06:30:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6936EDFB90; Mon, 4 Apr 2016 06:30:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Mon, 04 Apr 2016 06:30:52 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/6] camel git commit: CAMEL-9549 - Improvement of error messages when compiling the schema 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 Authored: Sun Apr 3 14:25:01 2016 +0300 Committer: Claus Ibsen 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.