You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cn...@apache.org on 2016/06/21 18:36:27 UTC

[1/3] hadoop git commit: HADOOP-13287. TestS3ACredentials#testInstantiateFromURL fails if AWS secret key contains +. Contributed by Chris Nauroth.

Repository: hadoop
Updated Branches:
  refs/heads/branch-2 910742ad1 -> e6ebe9ab4
  refs/heads/branch-2.8 6fefb8f4a -> e30b7112e
  refs/heads/trunk 605b4b613 -> b2c596cdd


HADOOP-13287. TestS3ACredentials#testInstantiateFromURL fails if AWS secret key contains +. Contributed by Chris Nauroth.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b2c596cd
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b2c596cd
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b2c596cd

Branch: refs/heads/trunk
Commit: b2c596cdda7c129951074bc53b4b9ecfedbf080a
Parents: 605b4b6
Author: Chris Nauroth <cn...@apache.org>
Authored: Tue Jun 21 11:28:52 2016 -0700
Committer: Chris Nauroth <cn...@apache.org>
Committed: Tue Jun 21 11:28:52 2016 -0700

----------------------------------------------------------------------
 .../hadoop/fs/s3a/TestS3ACredentialsInURL.java      | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b2c596cd/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
index f1da72b..8cb7c0f 100644
--- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
+++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
@@ -33,7 +33,6 @@ import org.slf4j.LoggerFactory;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
-import java.net.URISyntaxException;
 import java.net.URLEncoder;
 import java.nio.file.AccessDeniedException;
 
@@ -73,7 +72,11 @@ public class TestS3ACredentialsInURL extends Assert {
         accessKey, secretKey);
     if (secretKey.contains("/")) {
       assertTrue("test URI encodes the / symbol", secretsURI.toString().
-          contains("%2F"));
+          contains("%252F"));
+    }
+    if (secretKey.contains("+")) {
+      assertTrue("test URI encodes the + symbol", secretsURI.toString().
+          contains("%252B"));
     }
     assertFalse("Does not contain secrets", original.equals(secretsURI));
 
@@ -132,8 +135,7 @@ public class TestS3ACredentialsInURL extends Assert {
 
   private URI createUriWithEmbeddedSecrets(URI original,
       String accessKey,
-      String secretKey) throws URISyntaxException,
-      UnsupportedEncodingException {
+      String secretKey) throws UnsupportedEncodingException {
     String encodedSecretKey = URLEncoder.encode(secretKey, "UTF-8");
     String formattedString = String.format("%s://%s:%s@%s/%s/",
         original.getScheme(),
@@ -143,10 +145,10 @@ public class TestS3ACredentialsInURL extends Assert {
         original.getPath());
     URI testURI;
     try {
-      testURI = new URI(formattedString);
-    } catch (URISyntaxException e) {
+      testURI = new Path(formattedString).toUri();
+    } catch (IllegalArgumentException e) {
       // inner cause is stripped to keep any secrets out of stack traces
-      throw new URISyntaxException("", "Could not encode URI");
+      throw new IllegalArgumentException("Could not encode Path");
     }
     return testURI;
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[3/3] hadoop git commit: HADOOP-13287. TestS3ACredentials#testInstantiateFromURL fails if AWS secret key contains +. Contributed by Chris Nauroth.

Posted by cn...@apache.org.
HADOOP-13287. TestS3ACredentials#testInstantiateFromURL fails if AWS secret key contains +. Contributed by Chris Nauroth.

(cherry picked from commit b2c596cdda7c129951074bc53b4b9ecfedbf080a)
(cherry picked from commit e6ebe9ab4e38651b39c926d98b1d3d01e6a9ed71)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e30b7112
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e30b7112
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e30b7112

Branch: refs/heads/branch-2.8
Commit: e30b7112ed6b420e0442e701600035c6328493e3
Parents: 6fefb8f
Author: Chris Nauroth <cn...@apache.org>
Authored: Tue Jun 21 11:28:52 2016 -0700
Committer: Chris Nauroth <cn...@apache.org>
Committed: Tue Jun 21 11:34:46 2016 -0700

----------------------------------------------------------------------
 .../hadoop/fs/s3a/TestS3ACredentialsInURL.java      | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e30b7112/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
index f1da72b..8cb7c0f 100644
--- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
+++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
@@ -33,7 +33,6 @@ import org.slf4j.LoggerFactory;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
-import java.net.URISyntaxException;
 import java.net.URLEncoder;
 import java.nio.file.AccessDeniedException;
 
@@ -73,7 +72,11 @@ public class TestS3ACredentialsInURL extends Assert {
         accessKey, secretKey);
     if (secretKey.contains("/")) {
       assertTrue("test URI encodes the / symbol", secretsURI.toString().
-          contains("%2F"));
+          contains("%252F"));
+    }
+    if (secretKey.contains("+")) {
+      assertTrue("test URI encodes the + symbol", secretsURI.toString().
+          contains("%252B"));
     }
     assertFalse("Does not contain secrets", original.equals(secretsURI));
 
@@ -132,8 +135,7 @@ public class TestS3ACredentialsInURL extends Assert {
 
   private URI createUriWithEmbeddedSecrets(URI original,
       String accessKey,
-      String secretKey) throws URISyntaxException,
-      UnsupportedEncodingException {
+      String secretKey) throws UnsupportedEncodingException {
     String encodedSecretKey = URLEncoder.encode(secretKey, "UTF-8");
     String formattedString = String.format("%s://%s:%s@%s/%s/",
         original.getScheme(),
@@ -143,10 +145,10 @@ public class TestS3ACredentialsInURL extends Assert {
         original.getPath());
     URI testURI;
     try {
-      testURI = new URI(formattedString);
-    } catch (URISyntaxException e) {
+      testURI = new Path(formattedString).toUri();
+    } catch (IllegalArgumentException e) {
       // inner cause is stripped to keep any secrets out of stack traces
-      throw new URISyntaxException("", "Could not encode URI");
+      throw new IllegalArgumentException("Could not encode Path");
     }
     return testURI;
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[2/3] hadoop git commit: HADOOP-13287. TestS3ACredentials#testInstantiateFromURL fails if AWS secret key contains +. Contributed by Chris Nauroth.

Posted by cn...@apache.org.
HADOOP-13287. TestS3ACredentials#testInstantiateFromURL fails if AWS secret key contains +. Contributed by Chris Nauroth.

(cherry picked from commit b2c596cdda7c129951074bc53b4b9ecfedbf080a)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e6ebe9ab
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e6ebe9ab
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e6ebe9ab

Branch: refs/heads/branch-2
Commit: e6ebe9ab4e38651b39c926d98b1d3d01e6a9ed71
Parents: 910742a
Author: Chris Nauroth <cn...@apache.org>
Authored: Tue Jun 21 11:28:52 2016 -0700
Committer: Chris Nauroth <cn...@apache.org>
Committed: Tue Jun 21 11:32:11 2016 -0700

----------------------------------------------------------------------
 .../hadoop/fs/s3a/TestS3ACredentialsInURL.java      | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e6ebe9ab/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
index f1da72b..8cb7c0f 100644
--- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
+++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ACredentialsInURL.java
@@ -33,7 +33,6 @@ import org.slf4j.LoggerFactory;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
-import java.net.URISyntaxException;
 import java.net.URLEncoder;
 import java.nio.file.AccessDeniedException;
 
@@ -73,7 +72,11 @@ public class TestS3ACredentialsInURL extends Assert {
         accessKey, secretKey);
     if (secretKey.contains("/")) {
       assertTrue("test URI encodes the / symbol", secretsURI.toString().
-          contains("%2F"));
+          contains("%252F"));
+    }
+    if (secretKey.contains("+")) {
+      assertTrue("test URI encodes the + symbol", secretsURI.toString().
+          contains("%252B"));
     }
     assertFalse("Does not contain secrets", original.equals(secretsURI));
 
@@ -132,8 +135,7 @@ public class TestS3ACredentialsInURL extends Assert {
 
   private URI createUriWithEmbeddedSecrets(URI original,
       String accessKey,
-      String secretKey) throws URISyntaxException,
-      UnsupportedEncodingException {
+      String secretKey) throws UnsupportedEncodingException {
     String encodedSecretKey = URLEncoder.encode(secretKey, "UTF-8");
     String formattedString = String.format("%s://%s:%s@%s/%s/",
         original.getScheme(),
@@ -143,10 +145,10 @@ public class TestS3ACredentialsInURL extends Assert {
         original.getPath());
     URI testURI;
     try {
-      testURI = new URI(formattedString);
-    } catch (URISyntaxException e) {
+      testURI = new Path(formattedString).toUri();
+    } catch (IllegalArgumentException e) {
       // inner cause is stripped to keep any secrets out of stack traces
-      throw new URISyntaxException("", "Could not encode URI");
+      throw new IllegalArgumentException("Could not encode Path");
     }
     return testURI;
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org