[ 
https://issues.apache.org/jira/browse/HDFS-13313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated HDFS-13313:
----------------------------------
    Labels: pull-request-available  (was: )

> 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
>            Priority: Minor
>              Labels: pull-request-available
>
> 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
(v8.20.10#820010)

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

Reply via email to