Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
-
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
Attachments
Issue Links
- is related to
-
HADOOP-16453 Update how exceptions are handled in NetUtils
- Resolved
- relates to
-
HADOOP-16243 Change Log Level to trace in NetUtils.java
- Resolved
- links to