directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject [Patch] MultiException writing to wrong Stream/Writer
Date Mon, 31 Oct 2016 10:02:13 GMT
Hi there,

I suggest the following patch to MultiException:

Index: 
trunk-with-dependencies/shared/util/src/main/java/org/apache/directory/api/util/exception/MultiException.java
===================================================================
--- 
trunk-with-dependencies/shared/util/src/main/java/org/apache/directory/api/util/exception/MultiException.java

       (revision 1767225)
+++ 
trunk-with-dependencies/shared/util/src/main/java/org/apache/directory/api/util/exception/MultiException.java

       (working copy)
@@ -139,7 +139,7 @@
                  out.println( "\n\t<<========= Next Nested Exception" + 
" ========>>\n" );
              }

-            throwable.printStackTrace();
+            throwable.printStackTrace(out);
          }

          out.println( "\n\t<<========= Last Nested Exception" + " 
========>>\n" );
@@ -171,7 +171,7 @@
                  out.println( "\n\t<<========= Next Nested Exception" + 
" ========>>\n" );
              }

-            throwable.printStackTrace();
+            throwable.printStackTrace(out);
          }

          out.println( "\n\t<<========= Last Nested Exception" + " 
========>>\n" );


Both methods  printStackTrace(PrintWriter out) and public void 
printStackTrace(PrintStream out) write the main exception to the given 
out param, but the nested ones to the default Stream/Writer, which will 
by System.err. Although the path will be a change of behavior, I don't 
see a good reason to output the main exception and the nested ones to 
different streams/writers.

Regards,

Rainer



Mime
View raw message