You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/06/01 18:06:29 UTC

[GitHub] [nifi] tpalfy commented on a change in pull request #5093: NIFI-4344: Improve bulletin messages with exception details.

tpalfy commented on a change in pull request #5093:
URL: https://github.com/apache/nifi/pull/5093#discussion_r643370484



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/processor/TestSimpleProcessLogger.java
##########
@@ -24,16 +32,14 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import java.lang.reflect.Field;
+public class TestSimpleProcessLogger {
 
-import org.apache.nifi.logging.LogLevel;
-import org.apache.nifi.reporting.ReportingTask;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
+    private static final String NEW_LINE_ARROW = "\u2517\u25B6";
+    private static final String EXPECTED_CAUSES = "java.lang.RuntimeException: first" + System.lineSeparator() +

Review comment:
       The order of the expected exceptions should be: "third", "second", "first". (Note that "third" is the root cause.)
   See my comment on `SimpleProcessLogger`.

##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/processor/SimpleProcessLogger.java
##########
@@ -448,4 +455,13 @@ public void log(LogLevel level, String msg, Object[] os, Throwable t) {
         }
     }
 
+    private String getCauses(final Throwable throwable) {
+        final LinkedList<String> causes = new LinkedList<>();
+        for (Throwable t = throwable; t != null; t = t.getCause()) {
+            causes.push(t.toString());
+        }
+        Collections.reverse(causes);

Review comment:
       I think this was my suggestion so my bad.
   `causes.push(t.toString());` already establishes a reversed order because `push` adds the element to the _front_.
   So `Collections.reverse(causes);` is unnecessary (it actually reverses _back_ the order of elements).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org