wbo4958 commented on pull request #3222:
URL: https://github.com/apache/hadoop/pull/3222#issuecomment-885355456


   Ths @steveloughran  for the reviewing, for the code suggestion you gave is 
the same as the PR
   
   ``` java
             try {
               // When exception happens before re-setting wrappedStream in 
"reopen" called
               // by onReadFailure, then wrappedStream will be null. But the 
**retry** may
               // re-execute this block and cause NPE if we don't check 
wrappedStream
               if (wrappedStream == null) {
                 throw new IOException("Null IO stream for reading "  + uri);
               }
               b = wrappedStream.read();
             } catch (EOFException e) {
               return -1;
             } catch (SocketTimeoutException e) {
               onReadFailure(e, 1, true);
               throw e;
             } catch (IOException e) {
               onReadFailure(e, 1, false);
               throw e;
             }
   ```
   when wrappedStream is null, the IOException is thrown, then the catch block 
will call onReadFailure to retry.
   


-- 
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.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to