steveloughran commented on a change in pull request #1791: HADOOP-16785: wasb 
to raise IOE if write() invoked on a closed stream
URL: https://github.com/apache/hadoop/pull/1791#discussion_r363444853
 
 

 ##########
 File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsOutputStream.java
 ##########
 @@ -259,7 +259,15 @@ public synchronized void close() throws IOException {
   }
 
   private synchronized void flushInternal(boolean isClose) throws IOException {
-    maybeThrowLastError();
+    try {
+      maybeThrowLastError();
+    } catch (IOException e) {
+      if (isClose) {
+        // wrap existing exception so as to avoid breaking try-with-resources
+        throw new IOException("Skipping final flush and write due to " + e, e);
+      } else
+        throw e;
+    }
 
 Review comment:
   thought of that, but also thought it might be good to differentiate 
exception raised in the later bits of the flush. Keeping it in close() is 
cleaner as it puts the problem where it belongs

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to