HADOOP-15948. Inconsistency in get and put syntax if filename/dirname contains space. Contributed by Ayush Saxena.
(cherry picked from commit 23b441c2253bcb3be5229d3c5eb1e165369070c0) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1b937d70 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1b937d70 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1b937d70 Branch: refs/heads/branch-3.2 Commit: 1b937d701dfe5b603b338397b171d14f52895dbf Parents: f5d2806 Author: Vinayakumar B <vinayakum...@apache.org> Authored: Mon Nov 26 18:11:01 2018 +0530 Committer: Vinayakumar B <vinayakum...@apache.org> Committed: Mon Nov 26 18:13:09 2018 +0530 ---------------------------------------------------------------------- .../java/org/apache/hadoop/fs/shell/CopyCommands.java | 7 +------ .../org/apache/hadoop/fs/shell/TestCopyPreserveFlag.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/1b937d70/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java index da7a2b2..f59718f 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java @@ -274,12 +274,7 @@ class CopyCommands { try { items.add(new PathData(new URI(arg), getConf())); } catch (URISyntaxException e) { - if (Path.WINDOWS) { - // Unlike URI, PathData knows how to parse Windows drive-letter paths. - items.add(new PathData(arg, getConf())); - } else { - throw new IOException("unexpected URISyntaxException", e); - } + items.add(new PathData(arg, getConf())); } return items; } http://git-wip-us.apache.org/repos/asf/hadoop/blob/1b937d70/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCopyPreserveFlag.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCopyPreserveFlag.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCopyPreserveFlag.java index 8dd09e5..8d2e160 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCopyPreserveFlag.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCopyPreserveFlag.java @@ -43,9 +43,11 @@ public class TestCopyPreserveFlag { private static final int MODIFICATION_TIME = 12345000; private static final int ACCESS_TIME = 23456000; private static final Path DIR_FROM = new Path("d0"); + private static final Path DIR_FROM_SPL = new Path("d0 space"); private static final Path DIR_TO1 = new Path("d1"); private static final Path DIR_TO2 = new Path("d2"); private static final Path FROM = new Path(DIR_FROM, "f0"); + private static final Path FROM_SPL = new Path(DIR_FROM_SPL, "f0"); private static final Path TO = new Path(DIR_TO1, "f1"); private static final FsPermission PERMISSIONS = new FsPermission( FsAction.ALL, @@ -121,6 +123,14 @@ public class TestCopyPreserveFlag { } @Test(timeout = 10000) + public void testPutWithSplCharacter() throws Exception { + fs.mkdirs(DIR_FROM_SPL); + fs.createNewFile(FROM_SPL); + run(new Put(), FROM_SPL.toString(), TO.toString()); + assertAttributesChanged(TO); + } + + @Test(timeout = 10000) public void testCopyFromLocal() throws Exception { run(new CopyFromLocal(), FROM.toString(), TO.toString()); assertAttributesChanged(TO); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org