소스 검색

HADOOP-14807. should prevent the possibility of NPE about ReconfigurableBase.java. Contributed by hu xiaodong.

Wei-Chiu Chuang 6 년 전
부모
커밋
10311c30b0
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/ReconfigurableBase.java

+ 2 - 1
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/ReconfigurableBase.java

@@ -146,7 +146,8 @@ public abstract class ReconfigurableBase
             oldConf.unset(change.prop);
           }
         } catch (ReconfigurationException e) {
-          errorMessage = e.getCause().getMessage();
+          Throwable cause = e.getCause();
+          errorMessage = cause == null ? e.getMessage() : cause.getMessage();
         }
         results.put(change, Optional.ofNullable(errorMessage));
       }