From 61cda39e4eec00678706d96e90026455ecfc0a90 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Thu, 27 Apr 2017 12:19:04 +0100 Subject: [PATCH] HADOOP-14346. CryptoOutputStream throws IOException if stream is closed. Contributed by Pierre Lacave (cherry picked from commit 40b9c30d64ee1b07ade423533e627a7d4b099261) --- .../java/org/apache/hadoop/crypto/CryptoOutputStream.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/CryptoOutputStream.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/CryptoOutputStream.java index a771d96745..d2f146aa3e 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/CryptoOutputStream.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/CryptoOutputStream.java @@ -252,7 +252,9 @@ public synchronized void close() throws IOException { */ @Override public synchronized void flush() throws IOException { - checkStream(); + if (closed) { + return; + } encrypt(); super.flush(); }