Procházet zdrojové kódy

HDFS-15403. NPE in FileIoProvider#transferToSocketFully. Contributed by hemanthboyina.

(cherry picked from commit f41a144077fc0e2d32072e0d088c1abd1897cee5)
Takanobu Asanuma před 5 roky
rodič
revize
c2f908482f

+ 6 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FileIoProvider.java

@@ -282,7 +282,12 @@ public class FileIoProvider {
       profilingEventHook.afterFileIo(volume, TRANSFER, begin, count);
       profilingEventHook.afterFileIo(volume, TRANSFER, begin, count);
     } catch (Exception e) {
     } catch (Exception e) {
       String em = e.getMessage();
       String em = e.getMessage();
-      if (!em.startsWith("Broken pipe") && !em.startsWith("Connection reset")) {
+      if (em != null) {
+        if (!em.startsWith("Broken pipe")
+            && !em.startsWith("Connection reset")) {
+          onFailure(volume, begin);
+        }
+      } else {
         onFailure(volume, begin);
         onFailure(volume, begin);
       }
       }
       throw e;
       throw e;