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/04/16 08:58:45 UTC

[camel] branch camel-2.21.x updated (750c8e4 -> 26fd0fb)

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

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


    from 750c8e4  CAMEL-12441: Fixed splitter in parallel and streaming mode may block if iterator next throws exception on first call. Thanks to Bodor Maria Mihaela for reporting and reproducer sample project.
     new 24eefa5  CAMEL-12444: Improved DTD handling in validator component.
     new 26fd0fb  CAMEL-12441: 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:
 .../org/apache/camel/processor/validation/SchemaReader.java |  1 +
 .../camel/processor/validation/ValidatingProcessor.java     | 13 +++++++++++++
 .../SplitterParallelWithIteratorThrowingExceptionTest.java  |  4 ++--
 3 files changed, 16 insertions(+), 2 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 02/02: CAMEL-12441: 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.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 26fd0fb71042ce86b1c733de2724aeadc81bc940
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Apr 16 10:56:32 2018 +0200

    CAMEL-12441: Fixed CS
---
 .../issues/SplitterParallelWithIteratorThrowingExceptionTest.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelWithIteratorThrowingExceptionTest.java b/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelWithIteratorThrowingExceptionTest.java
index 0713d79..395f757 100644
--- a/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelWithIteratorThrowingExceptionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelWithIteratorThrowingExceptionTest.java
@@ -77,12 +77,12 @@ public class SplitterParallelWithIteratorThrowingExceptionTest extends ContextTe
 
     public static class MyIterator implements Iterator<String> {
 
+        private int count;
+
         public MyIterator(int count) {
             this.count = count;
         }
 
-        private int count;
-
         @Override
         public boolean hasNext() {
             return count < 2;

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 01/02: CAMEL-12444: Improved DTD handling in validator component.

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.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 24eefa559fe6b310629d2bf00663d2679ec81b96
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Apr 16 10:55:24 2018 +0200

    CAMEL-12444: Improved DTD handling in validator component.
---
 .../org/apache/camel/processor/validation/SchemaReader.java |  1 +
 .../camel/processor/validation/ValidatingProcessor.java     | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaReader.java b/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaReader.java
index ac42cc9..c77aea0 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaReader.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaReader.java
@@ -175,6 +175,7 @@ public class SchemaReader {
         }  
         if (camelContext == null || !Boolean.parseBoolean(camelContext.getGlobalOptions().get(ACCESS_EXTERNAL_DTD))) {
             try {
+                LOG.debug("Configuring SchemaFactory to not allow access to external DTD/Schema");
                 factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
             } catch (SAXException e) {
                 LOG.warn(e.getMessage(), e);
diff --git a/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
index 96b3db8..8bba7e7 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.net.URL;
 import java.util.Collections;
 
+import javax.xml.XMLConstants;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
@@ -53,6 +54,8 @@ import org.apache.camel.util.IOHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.processor.validation.SchemaReader.ACCESS_EXTERNAL_DTD;
+
 /**
  * A processor which validates the XML version of the inbound message body
  * against some schema either in XSD or RelaxNG
@@ -100,6 +103,16 @@ public class ValidatingProcessor implements AsyncProcessor {
         }
 
         Validator validator = schema.newValidator();
+        // turn off access to external schema by default
+        if (!Boolean.parseBoolean(exchange.getContext().getGlobalOptions().get(ACCESS_EXTERNAL_DTD))) {
+            try {
+                LOG.debug("Configuring Validator to not allow access to external DTD/Schema");
+                validator.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
+                validator.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
+            } catch (SAXException e) {
+                LOG.warn(e.getMessage(), e);
+            }
+        }
 
         // the underlying input stream, which we need to close to avoid locking files or other resources
         Source source = null;

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.