You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kathey Marsden (JIRA)" <ji...@apache.org> on 2008/10/09 23:42:44 UTC
[jira] Created: (DERBY-3905) Failed tests should save the database
off to the fail directory
Failed tests should save the database off to the fail directory
---------------------------------------------------------------
Key: DERBY-3905
URL: https://issues.apache.org/jira/browse/DERBY-3905
Project: Derby
Issue Type: Improvement
Components: Test
Affects Versions: 10.5.0.0
Reporter: Kathey Marsden
Priority: Minor
Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-3905) Failed tests should save the database
off to the fail directory
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden updated DERBY-3905:
----------------------------------
Derby Info: [Patch Available]
> Failed tests should save the database off to the fail directory
> ---------------------------------------------------------------
>
> Key: DERBY-3905
> URL: https://issues.apache.org/jira/browse/DERBY-3905
> Project: Derby
> Issue Type: Improvement
> Components: Test
> Affects Versions: 10.5.0.0
> Reporter: Kathey Marsden
> Assignee: Kathey Marsden
> Priority: Minor
> Attachments: derby-3905_diff.txt
>
>
> Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-3905) Failed tests should save the
database off to the fail directory
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638921#action_12638921 ]
Knut Anders Hatlen commented on DERBY-3905:
-------------------------------------------
The patch looks correct to me. Some small comments:
BaseTestCase.java:
- I felt that the old approach of re-throwing running from the finally clause was clearer than the new approach where we store it in a variable and re-throw it at the end of the method.
- There's a javadoc comment added, but no method for the javadoc.
- new File(failPath + File.separator + "derby.log") could be simplified to new File(failPath, "derby.log")
- ioe.printStackTrace() could be replaced with BaseTestCase.printStackTrace(ioe) so that it is always printed to the correct stream.
PrivilegedFileOpsForTests.java:
- No checked exception is thrown in the privileged action in getAbsolutePath(), so PrivilegedAction could be used instead of PrivilegedExceptionAction.
- SecurityException is a RuntimeException and will never be wrapped in a PrivilegedExceptionAction, so the "else if instance of SecurityException" part of copy() could be removed.
- FileNotFoundException is an IOException, so the "else if instance of FileNotFoundException" part of copy() could also be removed (FNFE will always be picked up by the first branch of the if statement)
> Failed tests should save the database off to the fail directory
> ---------------------------------------------------------------
>
> Key: DERBY-3905
> URL: https://issues.apache.org/jira/browse/DERBY-3905
> Project: Derby
> Issue Type: Improvement
> Components: Test
> Affects Versions: 10.5.0.0
> Reporter: Kathey Marsden
> Assignee: Kathey Marsden
> Priority: Minor
> Attachments: derby-3905_diff.txt
>
>
> Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-3905) Failed tests should save the
database off to the fail directory
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639450#action_12639450 ]
Knut Anders Hatlen commented on DERBY-3905:
-------------------------------------------
The article warns that returning from finally clauses could hide exceptions thrown in the try block. (I agree that's a problem, and at some point I think I even commented on some existing methods in store doing that. I should probably have filed a JIRA for that. Thanks for reminding me!) But hiding those exceptions is exactly what we're trying to achieve with this code, so I believe it is safe. The reason why I felt it was clearer, was that all the logic for re-throwing the exception was located in a single place (the finally clause), but I don't think it's a big issue.
One thing that changed with the patch, is this:
Without the patch, we re-throw the exception that caused the test failure regardless of what happens in the try block.
With the patch, we only re-throw the exception that caused the test failure if no error condition happened in the try block or if an IOException was thrown. If some other kind of exception or throwable was thrown, the error in the try block will hide the error in the test.
> Failed tests should save the database off to the fail directory
> ---------------------------------------------------------------
>
> Key: DERBY-3905
> URL: https://issues.apache.org/jira/browse/DERBY-3905
> Project: Derby
> Issue Type: Improvement
> Components: Test
> Affects Versions: 10.5.0.0
> Reporter: Kathey Marsden
> Assignee: Kathey Marsden
> Priority: Minor
> Attachments: derby-3905_diff.txt
>
>
> Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-3905) Failed tests should save the database
off to the fail directory
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden updated DERBY-3905:
----------------------------------
Attachment: derby-3905_diff2.txt
Attached is an updated patch that makes the changes recommended by Knut. Ran suites.All with no failures.
Thanks
Kathey
> Failed tests should save the database off to the fail directory
> ---------------------------------------------------------------
>
> Key: DERBY-3905
> URL: https://issues.apache.org/jira/browse/DERBY-3905
> Project: Derby
> Issue Type: Improvement
> Components: Test
> Affects Versions: 10.5.0.0
> Reporter: Kathey Marsden
> Assignee: Kathey Marsden
> Priority: Minor
> Attachments: derby-3905_diff.txt, derby-3905_diff2.txt
>
>
> Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-3905) Failed tests should save the database
off to the fail directory
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden updated DERBY-3905:
----------------------------------
Attachment: derby-3905_diff.txt
Attached is a patch for this issue, which copies the database on failure. The patch adds a copy method to PrivilegedFileOpsForTests and used that for both the database copy and derby.log copy.
Please review
Kathey
> Failed tests should save the database off to the fail directory
> ---------------------------------------------------------------
>
> Key: DERBY-3905
> URL: https://issues.apache.org/jira/browse/DERBY-3905
> Project: Derby
> Issue Type: Improvement
> Components: Test
> Affects Versions: 10.5.0.0
> Reporter: Kathey Marsden
> Assignee: Kathey Marsden
> Priority: Minor
> Attachments: derby-3905_diff.txt
>
>
> Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-3905) Failed tests should save the
database off to the fail directory
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639847#action_12639847 ]
Knut Anders Hatlen commented on DERBY-3905:
-------------------------------------------
Patch v2 looks fine to me. (One tiny nit: The two lines after the comment in recursiveCopy() are indented too far to the right.)
> Failed tests should save the database off to the fail directory
> ---------------------------------------------------------------
>
> Key: DERBY-3905
> URL: https://issues.apache.org/jira/browse/DERBY-3905
> Project: Derby
> Issue Type: Improvement
> Components: Test
> Affects Versions: 10.5.0.0
> Reporter: Kathey Marsden
> Assignee: Kathey Marsden
> Priority: Minor
> Attachments: derby-3905_diff.txt, derby-3905_diff2.txt
>
>
> Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (DERBY-3905) Failed tests should save the database
off to the fail directory
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden reassigned DERBY-3905:
-------------------------------------
Assignee: Kathey Marsden
> Failed tests should save the database off to the fail directory
> ---------------------------------------------------------------
>
> Key: DERBY-3905
> URL: https://issues.apache.org/jira/browse/DERBY-3905
> Project: Derby
> Issue Type: Improvement
> Components: Test
> Affects Versions: 10.5.0.0
> Reporter: Kathey Marsden
> Assignee: Kathey Marsden
> Priority: Minor
>
> Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DERBY-3905) Failed tests should save the database
off to the fail directory
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden closed DERBY-3905.
---------------------------------
Resolution: Fixed
Fix Version/s: 10.5.0.0
> Failed tests should save the database off to the fail directory
> ---------------------------------------------------------------
>
> Key: DERBY-3905
> URL: https://issues.apache.org/jira/browse/DERBY-3905
> Project: Derby
> Issue Type: Improvement
> Components: Test
> Affects Versions: 10.5.0.0
> Reporter: Kathey Marsden
> Assignee: Kathey Marsden
> Priority: Minor
> Fix For: 10.5.0.0
>
> Attachments: derby-3905_diff.txt, derby-3905_diff2.txt
>
>
> Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-3905) Failed tests should save the
database off to the fail directory
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639121#action_12639121 ]
Kathey Marsden commented on DERBY-3905:
---------------------------------------
With the old method of throwing the exception from the finally block I got a warning in Eclipse.
"finally block does not complete normally" so this was the reason I changed it. I read a little about the dangers of having a return statement or throwing an exception in a finally block at:
http://www.basilv.com/psd/blog/2007/a-tale-of-bad-exception-handling-in-finally-blocks-in-java
so concluded it was probably not a good idea to keep the exception thrown in the finally block.
Do you think it is safe/a good idea to change it back?
> Failed tests should save the database off to the fail directory
> ---------------------------------------------------------------
>
> Key: DERBY-3905
> URL: https://issues.apache.org/jira/browse/DERBY-3905
> Project: Derby
> Issue Type: Improvement
> Components: Test
> Affects Versions: 10.5.0.0
> Reporter: Kathey Marsden
> Assignee: Kathey Marsden
> Priority: Minor
> Attachments: derby-3905_diff.txt
>
>
> Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-3905) Failed tests should save the
database off to the fail directory
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638588#action_12638588 ]
Kathey Marsden commented on DERBY-3905:
---------------------------------------
I implemented this by using File.rename() to move the database directory to the failure directory on failure which seems to work fine except for in the case where we have a CleanDatabaseTestSetup./decoratesql, where we lose the initial setup so subsequent tests may fail because the table setup isn't there. Perhaps a recursive copy would be better, but slower. I'll try to write a method to do the recursive copy because I don't see anything readily available in Java and see how that goes.
> Failed tests should save the database off to the fail directory
> ---------------------------------------------------------------
>
> Key: DERBY-3905
> URL: https://issues.apache.org/jira/browse/DERBY-3905
> Project: Derby
> Issue Type: Improvement
> Components: Test
> Affects Versions: 10.5.0.0
> Reporter: Kathey Marsden
> Priority: Minor
>
> Currently failed tests save the derby.log to the fail directory for that test. It would be useful to save the database as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.