Tianyi Wang created HDFS-13313:
----------------------------------

             Summary: FSEditLogOp.toString() throws NullPointerException
                 Key: HDFS-13313
                 URL: https://issues.apache.org/jira/browse/HDFS-13313
             Project: Hadoop HDFS
          Issue Type: Bug
    Affects Versions: 3.0.2
            Reporter: Tianyi Wang


In some subclasses of FSEditLogOp, toString() [uses dot (.) operator on some 
could-be-null 
fields|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java#L3896].
 Those fields could be set to null by 
[resetSubFields()|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java#L3857].
 This error can be hit by turning on debug logging: toString() is called in 
[FSEditLogAsync.logSync()|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogAsync.java#L128]
 with debug logging and reset() is called in 
[doEditTransaction()|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java#L484]
 when the operation is executed asynchronously.

Proposed change: Avoid "field of field" access in toString() and use 
StringBuilder.append(field) because those fields have toString() themselves, 
and it would append "null" to the string if 'field' is null. 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to