[ 
https://issues.apache.org/jira/browse/DERBY-3618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615756#action_12615756
 ] 

Knut Anders Hatlen commented on DERBY-3618:
-------------------------------------------

A couple of comments to the version 7 patch:

  - The description of the issue says that the thread dump should be printed to 
derby.log, but this patch seems to put the thread dump in the output from 
printStackTrace(), which goes much broader. Doesn't this make the stack traces 
harder to read, and debugging problems where we don't care about the thread 
dumps harder? Perhaps it's better to intercept AssertFailure (or perhaps any 
error?) in BaseTestCase.runBare() and write the thread dump to a log file?

  - The added code in AssertFailure.java is inconsistently indented (some lines 
use tabs, others use spaces, and some use a mix of tabs and spaces)

  - Is the three level nesting of try/catch blocks in 
AssertFailure.dumpThreads() needed? Could they be merged into one?

  - The outer catch block in dumpThreads() has an instanceof test and a cast. 
Could it instead have a separate catch clause for InvocationTargetException?

  - In dumpThread(), this code could be simplified to 
Thread.class.getMethod(...):
+                   Class c = Class.forName("java.lang.Thread");
+                   c.getMethod("getAllStackTraces", new Class[] {});

  - Perhaps a StringWriter is more appropriate than a ByteArrayOutputStream to 
generate the string in dumpThread()?

  - ThreadDump.java has the wrong package name in its header.

  - AssertFailureTest: Use constant JVMInfo.J2SE_15 for readability?

> Perform thread dump with ASSERTS with jdk 1.5 or higher
> -------------------------------------------------------
>
>                 Key: DERBY-3618
>                 URL: https://issues.apache.org/jira/browse/DERBY-3618
>             Project: Derby
>          Issue Type: Improvement
>          Components: Services
>    Affects Versions: 10.5.0.0
>            Reporter: Kathey Marsden
>            Assignee: Erlend Birkenes
>            Priority: Minor
>             Fix For: 10.5.0.0
>
>         Attachments: DERBY-3618_1.diff, DERBY-3618_2.diff, DERBY-3618_3.diff, 
> DERBY-3618_4.diff, DERBY-3618_5.diff, DERBY-3618_6.diff, DERBY-3618_7.diff
>
>
> It would be good to have a stack traces for all threads dump to the derby.log 
> when an assertion occurs with JVM's that support it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to