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 "Jagadesh Kiran N (JIRA)" <ji...@apache.org> on 2015/07/31 12:09:04 UTC

[jira] [Assigned] (HDFS-8841) Catch throwable return null

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

Jagadesh Kiran N reassigned HDFS-8841:
--------------------------------------

    Assignee: Jagadesh Kiran N

> Catch throwable return null
> ---------------------------
>
>                 Key: HDFS-8841
>                 URL: https://issues.apache.org/jira/browse/HDFS-8841
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: songwanging
>            Assignee: Jagadesh Kiran N
>            Priority: Minor
>
> In method "map" of class: \hadoop-2.7.1-src\hadoop-tools\hadoop-extras\src\main\java\org\apache\hadoop\tools\DistCpV1.java.
> This method has this code:
>  public void map(LongWritable key,
>                     FilePair value,
>                     OutputCollector<WritableComparable<?>, Text> out,
>                     Reporter reporter) throws IOException {
>          ...
>             } catch (Throwable ex) {
>               // ignore, we are just cleaning up
>               LOG.debug("Ignoring cleanup exception", ex);
>             }
>            ....
>           }
>         } 
>         ...
>     }
> Throwable is the parent type of Exception and Error, so catching Throwable means catching both Exceptions as well as Errors. An Exception is something you could recover (like IOException), an Error is something more serious and usually you could'nt recover easily (like ClassNotFoundError) so it doesn't make much sense to catch an Error.
> We should  convert to catch Exception instead.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)