From 062d9c9bab5eb0c3852316bb7e866679fca49f58 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Fri, 20 Oct 2017 22:27:59 +0100 Subject: [PATCH] HADOOP-14942. DistCp#cleanup() should check whether jobFS is null. Contributed by Andras Bokor. (cherry picked from commit f36cbc847560d53e7955ced9ce7ce2773c805793) --- .../src/main/java/org/apache/hadoop/tools/DistCp.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCp.java b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCp.java index ddf67ff41ae..468cdff8188 100644 --- a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCp.java +++ b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCp.java @@ -538,10 +538,12 @@ public class DistCp extends Configured implements Tool { private synchronized void cleanup() { try { - if (metaFolder == null) return; - - jobFS.delete(metaFolder, true); - metaFolder = null; + if (metaFolder != null) { + if (jobFS != null) { + jobFS.delete(metaFolder, true); + } + metaFolder = null; + } } catch (IOException e) { LOG.error("Unable to cleanup meta folder: " + metaFolder, e); }