You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/08/01 15:55:00 UTC

[jira] [Work logged] (HDFS-16710) Remove redundant throw exceptions in org.apahce.hadoop.hdfs.server.namenode package

     [ https://issues.apache.org/jira/browse/HDFS-16710?focusedWorklogId=796943&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-796943 ]

ASF GitHub Bot logged work on HDFS-16710:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Aug/22 15:54
            Start Date: 01/Aug/22 15:54
    Worklog Time Spent: 10m 
      Work Description: ZanderXu opened a new pull request, #4670:
URL: https://github.com/apache/hadoop/pull/4670

   ### Description of PR
   When I read some class about HDFS NameNode, I found there are many redundant throw exception in org.apahce.hadoop.hdfs.server.namenode package, such as:
   ```
   public synchronized void transitionToObserver(StateChangeRequestInfo req)
       throws ServiceFailedException, AccessControlException, IOException {
     checkNNStartup();
     nn.checkHaStateChange(req);
     nn.transitionToObserver();
   } 
   ```
   
   Because ServiceFailedException and AccessControlException is subClass of IOException, so I feel that ServiceFailedException and AccessControlException are redundant, so we can remove it to make code clearer, such as:
   ```
   public synchronized void transitionToObserver(StateChangeRequestInfo req)
       throws IOException {
     checkNNStartup();
     nn.checkHaStateChange(req);
     nn.transitionToObserver();
   }  
   ```
   
   




Issue Time Tracking
-------------------

            Worklog Id:     (was: 796943)
    Remaining Estimate: 0h
            Time Spent: 10m

> Remove redundant throw exceptions in org.apahce.hadoop.hdfs.server.namenode package
> -----------------------------------------------------------------------------------
>
>                 Key: HDFS-16710
>                 URL: https://issues.apache.org/jira/browse/HDFS-16710
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: ZanderXu
>            Assignee: ZanderXu
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When I read some class about HDFS NameNode, I found there are many redundant throw exception in org.apahce.hadoop.hdfs.server.namenode package, such as:
> {code:java}
> public synchronized void transitionToObserver(StateChangeRequestInfo req)
>     throws ServiceFailedException, AccessControlException, IOException {
>   checkNNStartup();
>   nn.checkHaStateChange(req);
>   nn.transitionToObserver();
> } {code}
> Because ServiceFailedException and AccessControlException is subClass of IOException, so I feel that ServiceFailedException and AccessControlException are redundant, so we can remove it to make code clearer, such as:
> {code:java}
> public synchronized void transitionToObserver(StateChangeRequestInfo req)
>     throws IOException {
>   checkNNStartup();
>   nn.checkHaStateChange(req);
>   nn.transitionToObserver();
> } {code}
>  



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

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