diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/commit/CommitOperations.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/commit/CommitOperations.java index c09278fbdc..cd8257f97f 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/commit/CommitOperations.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/commit/CommitOperations.java @@ -485,7 +485,7 @@ public SinglePendingCommit uploadFileToPendingCommit(File localFile, if (!localFile.isFile()) { throw new FileNotFoundException("Not a file: " + localFile); } - String destURI = destPath.toString(); + String destURI = destPath.toUri().toString(); String destKey = fs.pathToKey(destPath); String uploadId = null; diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/ITestCommitOperations.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/ITestCommitOperations.java index 4d7f81d019..ab2f9a2d31 100644 --- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/ITestCommitOperations.java +++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/ITestCommitOperations.java @@ -673,7 +673,7 @@ public void testBulkCommitFiles() throws Throwable { Path subdir = new Path(destDir, "subdir"); // file 2 Path destFile2 = new Path(subdir, "file2"); - Path destFile3 = new Path(subdir, "file3"); + Path destFile3 = new Path(subdir, "file3 with space"); List destinations = Lists.newArrayList(destFile1, destFile2, destFile3); List commits = new ArrayList<>(3);