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

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


The following commit(s) were added to refs/heads/camel-2.20.x by this push:
     new bb47a4f  CAMEL-11912: Camel Dropbox validator regex is too restrictive 
and fails for common paths. Reduce the regexp and just check for windows path 
and fail.
bb47a4f is described below

commit bb47a4f4b25c6ec151a8f582ee47080b004f9a6b
Author: Claus Ibsen <davscl...@apache.org>
AuthorDate: Fri Oct 20 12:43:39 2017 +0200

    CAMEL-11912: Camel Dropbox validator regex is too restrictive and fails for 
common paths. Reduce the regexp and just check for windows path and fail.
---
 .../dropbox/validator/DropboxConfigurationValidator.java       | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git 
a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/validator/DropboxConfigurationValidator.java
 
b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/validator/DropboxConfigurationValidator.java
index e6564e4..56701e6 100755
--- 
a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/validator/DropboxConfigurationValidator.java
+++ 
b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/validator/DropboxConfigurationValidator.java
@@ -17,8 +17,6 @@
 package org.apache.camel.component.dropbox.validator;
 
 import java.io.File;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 import org.apache.camel.component.dropbox.DropboxConfiguration;
 import org.apache.camel.component.dropbox.util.DropboxConstants;
@@ -28,11 +26,8 @@ import org.apache.camel.util.ObjectHelper;
 
 public final class DropboxConfigurationValidator {
 
-    private static final Pattern PATTERN = Pattern.compile("/*?(\\S+)/*?", 
Pattern.CASE_INSENSITIVE);
-
     private DropboxConfigurationValidator() { }
 
-
     public static void validateCommonProperties(DropboxConfiguration 
configuration) throws DropboxException {
         if (configuration.getAccessToken() == null || 
configuration.getAccessToken().equals("")) {
             throw new DropboxException("option <accessToken> is not present or 
not valid!");
@@ -96,9 +91,8 @@ public final class DropboxConfigurationValidator {
     }
 
     private static void validatePathInUnix(String path) throws 
DropboxException {
-        Matcher matcher = PATTERN.matcher(path);
-        if (!matcher.matches()) {
-            throw new DropboxException(path + " is not a valid path, must be 
in UNIX form!");
+        if (path.indexOf('\\') != -1) {
+            throw new DropboxException(path + " must not contain Windows path 
separator, use UNIX path separator!");
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <commits@camel.apache.org>'].

Reply via email to