From 962b5e722ba86d1c012be11280c6b8fb5e0a2043 Mon Sep 17 00:00:00 2001 From: Virajith Jalaparti Date: Thu, 7 Dec 2017 14:21:24 -0800 Subject: [PATCH] HDFS-12903. [READ] Fix closing streams in ImageWriter --- .../org/apache/hadoop/hdfs/server/namenode/ImageWriter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-tools/hadoop-fs2img/src/main/java/org/apache/hadoop/hdfs/server/namenode/ImageWriter.java b/hadoop-tools/hadoop-fs2img/src/main/java/org/apache/hadoop/hdfs/server/namenode/ImageWriter.java index 0abc7a7fb4..c21c2822aa 100644 --- a/hadoop-tools/hadoop-fs2img/src/main/java/org/apache/hadoop/hdfs/server/namenode/ImageWriter.java +++ b/hadoop-tools/hadoop-fs2img/src/main/java/org/apache/hadoop/hdfs/server/namenode/ImageWriter.java @@ -183,9 +183,9 @@ public ImageWriter(Options opts) throws IOException { dirsTmp.deleteOnExit(); dirsTmpStream = new FileOutputStream(dirsTmp); dirs = beginSection(dirsTmpStream); - } catch (IOException e) { + } catch (Throwable e) { IOUtils.cleanupWithLogger(null, raw, dirsTmpStream); - throw e; + throw new IOException(e); } try {