Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-8841

Catch throwable return null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            songwang songwanging
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: