Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-16431

Remove useless log in IOUtils.java and ExceptionDiags.java

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      When there is no String Constructor for the exception, we Log a Warn Message, and rethrow the exception. We can change the Log level to TRACE/DEBUG.

      private static <T extends IOException> T wrapWithMessage(
        T exception, String msg) {
        Class<? extends Throwable> clazz = exception.getClass();
        try {
          Constructor<? extends Throwable> ctor =
            clazz.getConstructor(String.class);
          Throwable t = ctor.newInstance(msg);
          return (T) (t.initCause(exception));
        } catch (Throwable e) {
          LOG.trace("Unable to wrap exception of type " +
                   clazz + ": it has no (String) constructor", e);
          return exception;
        }
      }
      

        Attachments

        1. HADOOP-16431.002.patch
          2 kB
          Lisheng Sun
        2. HADOOP-16431.001.patch
          2 kB
          Lisheng Sun

          Issue Links

            Activity

              People

              • Assignee:
                leosun08 Lisheng Sun
                Reporter:
                leosun08 Lisheng Sun
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: