NIFI-491: Fixed bug that caused InvocationTargetException.getCause().getCause() instead of InvocationTargetException.getCause(); also if null passed into logger, avoid the NPE that results

This commit is contained in:
Mark Payne 2015-04-07 12:41:31 -04:00
parent a7862a19ba
commit c974ea90f8
2 changed files with 3 additions and 3 deletions

View File

@ -339,8 +339,8 @@ public final class StandardProcessScheduler implements ProcessScheduler {
final ProcessorLog procLog = new SimpleProcessLogger(procNode.getIdentifier(), procNode.getProcessor()); final ProcessorLog procLog = new SimpleProcessLogger(procNode.getIdentifier(), procNode.getProcessor());
procLog.error("{} failed to invoke @OnScheduled method due to {}; processor will not be scheduled to run for {}", procLog.error("{} failed to invoke @OnScheduled method due to {}; processor will not be scheduled to run for {}",
new Object[]{procNode.getProcessor(), cause.getCause(), administrativeYieldDuration}, cause.getCause()); new Object[]{procNode.getProcessor(), cause, administrativeYieldDuration}, cause);
LOG.error("Failed to invoke @OnScheduled method due to {}", cause.getCause().toString(), cause.getCause()); LOG.error("Failed to invoke @OnScheduled method due to {}", cause.toString(), cause);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnUnscheduled.class, procNode.getProcessor(), processContext); ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnUnscheduled.class, procNode.getProcessor(), processContext);
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnStopped.class, procNode.getProcessor(), processContext); ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnStopped.class, procNode.getProcessor(), processContext);

View File

@ -243,7 +243,7 @@ public class SimpleProcessLogger implements ProcessorLog {
for (int i = 0; i < os.length; i++) { for (int i = 0; i < os.length; i++) {
modifiedArgs[i + 1] = os[i]; modifiedArgs[i + 1] = os[i];
} }
modifiedArgs[modifiedArgs.length - 1] = t.toString(); modifiedArgs[modifiedArgs.length - 1] = (t == null) ? "" : t.toString();
return modifiedArgs; return modifiedArgs;
} }