You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Rainer Jung <ra...@kippdata.de> on 2016/10/31 10:02:13 UTC

[Patch] MultiException writing to wrong Stream/Writer

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



Re: [Patch] MultiException writing to wrong Stream/Writer

Posted by Rainer Jung <ra...@kippdata.de>.
Am 16.11.2016 um 22:53 schrieb Stefan Seelmann:
> Done, sorry for the delay, and thanks for the report and ping :)
>
> I also fixed the RuntimeMultiException and added test.
>
> http://svn.apache.org/viewvc?rev=1770062&view=rev
>
> Kind Regards,
> Stefan

Thanks a bunch!

Re: [Patch] MultiException writing to wrong Stream/Writer

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
Done, sorry for the delay, and thanks for the report and ping :)

I also fixed the RuntimeMultiException and added test.

http://svn.apache.org/viewvc?rev=1770062&view=rev

Kind Regards,
Stefan


On November 16, 2016 8:20:19 PM GMT+01:00, Rainer Jung <ra...@kippdata.de> wrote:
>Friendly ping, any takers for this trivial patch?
>
>You might not believe it, but that missing "out" argument in
>combination 
>with a bug totally unrelated to directory server lead to a deadlock in 
>an application.
>
>Thanks and regards,
>
>Rainer
>
>Am 31.10.2016 um 11:02 schrieb Rainer Jung:
>> 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

Re: [Patch] MultiException writing to wrong Stream/Writer

Posted by Rainer Jung <ra...@kippdata.de>.
Friendly ping, any takers for this trivial patch?

You might not believe it, but that missing "out" argument in combination 
with a bug totally unrelated to directory server lead to a deadlock in 
an application.

Thanks and regards,

Rainer

Am 31.10.2016 um 11:02 schrieb Rainer Jung:
> 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