You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/08/07 12:07:34 UTC

[camel] branch camel-2.22.x updated (6cd0a8f -> c4229f2)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 6cd0a8f  CAMEL-12565: Added unit tests. Fixed a little issue in validator to ensure exception is set on exchange to allow advice to keep executing the next ones.
     new 818311c  CAMEL-12713 - XsltUriResolver fix: relative paths can remove scheme from XSLT URI (#2456)
     new c4229f2  CAMEL-12713: Fixed CS

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/camel/builder/xml/XsltUriResolver.java  |  7 ++-
 .../xml/XsltUriResolverTest.java}                  | 69 +++++++++++-----------
 2 files changed, 39 insertions(+), 37 deletions(-)
 copy camel-core/src/test/java/org/apache/camel/{management/CamelContextDisableJmxTest.java => builder/xml/XsltUriResolverTest.java} (64%)


[camel] 01/02: CAMEL-12713 - XsltUriResolver fix: relative paths can remove scheme from XSLT URI (#2456)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 818311c3ba93363a1b651475f23be5c0679c93c8
Author: Peter Van den Bosch <pe...@gmail.com>
AuthorDate: Tue Aug 7 14:02:35 2018 +0200

    CAMEL-12713 - XsltUriResolver fix: relative paths can remove scheme from XSLT URI (#2456)
---
 .../org/apache/camel/builder/xml/XsltUriResolver.java  |  7 +++++--
 .../apache/camel/builder/xml/XsltUriResolverTest.java  | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/builder/xml/XsltUriResolver.java b/camel-core/src/main/java/org/apache/camel/builder/xml/XsltUriResolver.java
index c7d528c..7b3866d 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/xml/XsltUriResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/xml/XsltUriResolver.java
@@ -27,6 +27,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ResourceHelper;
+import org.apache.camel.util.StringHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -74,14 +75,16 @@ public class XsltUriResolver implements URIResolver {
         LOG.trace("Resolving URI with href: {} and base: {}", href, base);
 
         String scheme = ResourceHelper.getScheme(href);
+
         if (scheme != null) {
             // need to compact paths for file/classpath as it can be relative paths using .. to go backwards
+            String hrefPath = StringHelper.after(href, scheme);
             if ("file:".equals(scheme)) {
                 // compact path use file OS separator
-                href = FileUtil.compactPath(href);
+                href = scheme + FileUtil.compactPath(hrefPath);
             } else if ("classpath:".equals(scheme)) {
                 // for classpath always use /
-                href = FileUtil.compactPath(href, '/');
+                href = scheme + FileUtil.compactPath(hrefPath, '/');
             }
             LOG.debug("Resolving URI from {}: {}", scheme, href);
 
diff --git a/camel-core/src/test/java/org/apache/camel/builder/xml/XsltUriResolverTest.java b/camel-core/src/test/java/org/apache/camel/builder/xml/XsltUriResolverTest.java
new file mode 100644
index 0000000..6d4df9e
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/builder/xml/XsltUriResolverTest.java
@@ -0,0 +1,18 @@
+package org.apache.camel.builder.xml;
+
+import junit.framework.TestCase;
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
+
+import javax.xml.transform.Source;
+
+public class XsltUriResolverTest extends TestCase {
+
+    public void testResolveUri() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        XsltUriResolver xsltUriResolver = new XsltUriResolver(context, "classpath:xslt/staff/staff.xsl");
+        Source source = xsltUriResolver.resolve("../../xslt/common/staff_template.xsl", "classpath:xslt/staff/staff.xsl");
+        assertNotNull(source);
+        assertEquals("classpath:xslt/common/staff_template.xsl", source.getSystemId());
+    }
+}


[camel] 02/02: CAMEL-12713: Fixed CS

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c4229f245af3d5934e8d1396ca4284c480dd6b82
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Aug 7 14:05:04 2018 +0200

    CAMEL-12713: Fixed CS
---
 .../camel/builder/xml/XsltUriResolverTest.java       | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/camel-core/src/test/java/org/apache/camel/builder/xml/XsltUriResolverTest.java b/camel-core/src/test/java/org/apache/camel/builder/xml/XsltUriResolverTest.java
index 6d4df9e..99fe59f 100644
--- a/camel-core/src/test/java/org/apache/camel/builder/xml/XsltUriResolverTest.java
+++ b/camel-core/src/test/java/org/apache/camel/builder/xml/XsltUriResolverTest.java
@@ -1,11 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.camel.builder.xml;
 
+import javax.xml.transform.Source;
+
 import junit.framework.TestCase;
 import org.apache.camel.CamelContext;
 import org.apache.camel.impl.DefaultCamelContext;
 
-import javax.xml.transform.Source;
-
 public class XsltUriResolverTest extends TestCase {
 
     public void testResolveUri() throws Exception {