[ 
https://issues.apache.org/jira/browse/HDFS-17443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17831502#comment-17831502
 ] 

ASF GitHub Bot commented on HDFS-17443:
---------------------------------------

teamconfx opened a new pull request, #6683:
URL: https://github.com/apache/hadoop/pull/6683

   ### Description of PR
   This PR provides a fix for HDFS-17443 by adding null checking for fileSys 
and cluster before stopping them in the `finally` in 
`TestNameEditsConfigs#testNameEditsConfigsFailure`.
   
   ### How was this patch tested?
   The patch is tested via setting dfs.namenode.edits.dir.minimum to 251625215 
and running 
org.apache.hadoop.hdfs.server.namenode.TestNameEditsConfigs#testNameEditsConfigsFailure,
 which would throw the correct exception.
   
   ### For code changes:
   
   - [x] Does the title or this PR starts with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [x] Object storage: have the integration tests been executed and the 
endpoint declared according to the connector-specific documentation?
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   




> TestNameEditsConfigs does not check null before closing fileSys and cluster
> ---------------------------------------------------------------------------
>
>                 Key: HDFS-17443
>                 URL: https://issues.apache.org/jira/browse/HDFS-17443
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: ConfX
>            Priority: Major
>
> h2. What happened:
> Got NullPointerException when trying to run TestNameEditsConfigs with 
> misconfiguration rather than the actual exception.
> h2. Buggy code:
> {code:java}
>   @Test
>   public void testNameEditsConfigsFailure() throws IOException {
>     ...
>     } finally  {
>       fileSys.close(); // here fileSys might be null
>       cluster.shutdown();
>     }{code}
> h2. StackTrace:
> {code:java}
> java.lang.NullPointerException: Cannot invoke 
> "org.apache.hadoop.fs.FileSystem.close()" because "fileSys" is null
>    at 
> org.apache.hadoop.hdfs.server.namenode.TestNameEditsConfigs.testNameEditsConfigsFailure(TestNameEditsConfigs.java:450){code}
> h2. How to reproduce:
> (1) Set {{dfs.namenode.edits.dir.minimum}} to {{251625215}}
> (2) Run test: 
> {{org.apache.hadoop.hdfs.server.namenode.TestNameEditsConfigs#testNameEditsConfigsFailure}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to