From fcacb14a1e3738d5a974d415ab98af46b9fd3ded Mon Sep 17 00:00:00 2001 From: Robert Joseph Evans Date: Wed, 4 Apr 2012 19:53:09 +0000 Subject: [PATCH] HADOOP-8179. risk of NPE in CopyCommands processArguments() (Daryn Sharp via bobby) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1309572 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index c1e859e821..6387a940e0 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -386,6 +386,9 @@ Release 0.23.3 - UNRELEASED HADOOP-8088. User-group mapping cache incorrectly does negative caching on transient failures (Khiwal Lee via bobby) + HADOOP-8179. risk of NPE in CopyCommands processArguments() (Daryn Sharp + via bobby) + Release 0.23.2 - UNRELEASED INCOMPATIBLE CHANGES 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 3d999ed54d..15155fac80 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 @@ -81,10 +81,9 @@ protected void processArguments(LinkedList items) } FSDataOutputStream out = dst.fs.create(dst.path); try { - FSDataInputStream in = null; for (PathData src : srcs) { + FSDataInputStream in = src.fs.open(src.path); try { - in = src.fs.open(src.path); IOUtils.copyBytes(in, out, getConf(), false); if (delimiter != null) { out.write(delimiter.getBytes("UTF-8"));