[ 
https://issues.apache.org/jira/browse/HADOOP-15430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16478404#comment-16478404
 ] 

Aaron Fabbri commented on HADOOP-15430:
---------------------------------------

Great work here. Test code is very nice.
{quote}+ // here the problem: the URI constructor doesn't strip trailing "/" 
chars
{quote}
Sigh. Unfortunate. 

 
{noformat}
 
+  @Override
+  public Path makeQualified(final Path path) {
+    Path q = super.makeQualified(path);
+    if (!q.isRoot()) {
+      String urlString = q.toUri().toString();
+      if (urlString.endsWith(Path.SEPARATOR)) {
+        // this is a path which needs root stripping off to avoid
+        // confusion, See HADOOP-15430
+        LOG.debug("Stripping trailing '/' from {}", q);
+        // deal with an empty "/" at the end by mapping to the parent and
+        // creating a new path from it
{noformat}
super minor nit.. you could omit that last comment i think, seems like you 
changed your approach?
{noformat}
+        q = new Path(urlString.substring(0, urlString.length() - 1));
+      }
+    }
+    if (!q.isRoot() && q.getName().isEmpty()) {
+      q = q.getParent();
+    }
{noformat}
This part, I'm assuming is for the trailing double slash case, right?

Anyways +1, LGTM pending paying the checkstyle tax.

> hadoop fs -mkdir -p path-ending-with-slash/ fails with s3guard
> --------------------------------------------------------------
>
>                 Key: HADOOP-15430
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15430
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/s3
>    Affects Versions: 3.1.0
>            Reporter: Steve Loughran
>            Assignee: Steve Loughran
>            Priority: Blocker
>         Attachments: HADOOP-15430-001.patch, HADOOP-15430-002.patch, 
> HADOOP-15430-003.patch
>
>
> if you call {{hadoop fs -mkdir -p path/}} on the command line with a path 
> ending in "/:. you get a DDB error "An AttributeValue may not contain an 
> empty string"



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to