From f36cbc847560d53e7955ced9ce7ce2773c805793 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Fri, 20 Oct 2017 22:27:04 +0100 Subject: [PATCH] HADOOP-14942. DistCp#cleanup() should check whether jobFS is null. Contributed by Andras Bokor. --- .../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 df9c32896f..909494b4bb 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 @@ -453,10 +453,12 @@ private static Configuration getDefaultConf() { 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); }