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 "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2010/05/19 10:13:54 UTC

[jira] Created: (DERBY-4665) Unidiomatic error handling in TimestampArithTest

Unidiomatic error handling in TimestampArithTest
------------------------------------------------

                 Key: DERBY-4665
                 URL: https://issues.apache.org/jira/browse/DERBY-4665
             Project: Derby
          Issue Type: Bug
          Components: Test
    Affects Versions: 10.7.0.0
            Reporter: Knut Anders Hatlen
            Assignee: Knut Anders Hatlen


TimestampArithTest contains some error handling code that prevents the underlying error from being reported to the JUnit framework, and it may even terminate the JVM running the tests on some errors. Examples:

This code prints the stack trace of the underlying error to the terminal, but it won't be included in the report from the JUnit framework:

					printStackTrace(sqle);
					fail("Unexpected exception from statement '" + sql + "'");

This code terminates the JVM on error, preventing subsequent tests from running, and also preventing the JUnit framework to report the results from the tests that did run:

		} catch (Exception e) {
			System.out.println(s + " is not a proper timestamp string.");
			System.out.println(e.getClass().getName() + ": " + e.getMessage());
			e.printStackTrace();
			System.exit(1);
			return null;
		}

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


[jira] Closed: (DERBY-4665) Unidiomatic error handling in TimestampArithTest

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-4665.
-------------------------------------

    Issue & fix info:   (was: [Patch Available])
       Fix Version/s: 10.7.0.0
          Resolution: Fixed

> Unidiomatic error handling in TimestampArithTest
> ------------------------------------------------
>
>                 Key: DERBY-4665
>                 URL: https://issues.apache.org/jira/browse/DERBY-4665
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.7.0.0
>
>         Attachments: errors.diff, errors2.diff
>
>
> TimestampArithTest contains some error handling code that prevents the underlying error from being reported to the JUnit framework, and it may even terminate the JVM running the tests on some errors. Examples:
> This code prints the stack trace of the underlying error to the terminal, but it won't be included in the report from the JUnit framework:
> 					printStackTrace(sqle);
> 					fail("Unexpected exception from statement '" + sql + "'");
> This code terminates the JVM on error, preventing subsequent tests from running, and also preventing the JUnit framework to report the results from the tests that did run:
> 		} catch (Exception e) {
> 			System.out.println(s + " is not a proper timestamp string.");
> 			System.out.println(e.getClass().getName() + ": " + e.getMessage());
> 			e.printStackTrace();
> 			System.exit(1);
> 			return null;
> 		}

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


[jira] Commented: (DERBY-4665) Unidiomatic error handling in TimestampArithTest

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869114#action_12869114 ] 

Kristian Waagan commented on DERBY-4665:
----------------------------------------

+1 to commit 'errors.diff'

It seems the label passed in to expectNullResult is no longer printed in the case of a failure, but that shouldn't be much of a problem. Possible improvements could be to either add a println or turn the labels into comments.

> Unidiomatic error handling in TimestampArithTest
> ------------------------------------------------
>
>                 Key: DERBY-4665
>                 URL: https://issues.apache.org/jira/browse/DERBY-4665
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: errors.diff
>
>
> TimestampArithTest contains some error handling code that prevents the underlying error from being reported to the JUnit framework, and it may even terminate the JVM running the tests on some errors. Examples:
> This code prints the stack trace of the underlying error to the terminal, but it won't be included in the report from the JUnit framework:
> 					printStackTrace(sqle);
> 					fail("Unexpected exception from statement '" + sql + "'");
> This code terminates the JVM on error, preventing subsequent tests from running, and also preventing the JUnit framework to report the results from the tests that did run:
> 		} catch (Exception e) {
> 			System.out.println(s + " is not a proper timestamp string.");
> 			System.out.println(e.getClass().getName() + ": " + e.getMessage());
> 			e.printStackTrace();
> 			System.exit(1);
> 			return null;
> 		}

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


[jira] Updated: (DERBY-4665) Unidiomatic error handling in TimestampArithTest

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4665:
--------------------------------------

    Issue & fix info: [Patch Available]

> Unidiomatic error handling in TimestampArithTest
> ------------------------------------------------
>
>                 Key: DERBY-4665
>                 URL: https://issues.apache.org/jira/browse/DERBY-4665
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: errors.diff
>
>
> TimestampArithTest contains some error handling code that prevents the underlying error from being reported to the JUnit framework, and it may even terminate the JVM running the tests on some errors. Examples:
> This code prints the stack trace of the underlying error to the terminal, but it won't be included in the report from the JUnit framework:
> 					printStackTrace(sqle);
> 					fail("Unexpected exception from statement '" + sql + "'");
> This code terminates the JVM on error, preventing subsequent tests from running, and also preventing the JUnit framework to report the results from the tests that did run:
> 		} catch (Exception e) {
> 			System.out.println(s + " is not a proper timestamp string.");
> 			System.out.println(e.getClass().getName() + ": " + e.getMessage());
> 			e.printStackTrace();
> 			System.exit(1);
> 			return null;
> 		}

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


[jira] Updated: (DERBY-4665) Unidiomatic error handling in TimestampArithTest

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4665:
--------------------------------------

    Attachment: errors.diff

The attached patch makes the code stop printing the errors, and instead lets the exceptions propagate to the JUnit framework, either by removing try/catch or by using helper methods that preserve the original exception.

> Unidiomatic error handling in TimestampArithTest
> ------------------------------------------------
>
>                 Key: DERBY-4665
>                 URL: https://issues.apache.org/jira/browse/DERBY-4665
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: errors.diff
>
>
> TimestampArithTest contains some error handling code that prevents the underlying error from being reported to the JUnit framework, and it may even terminate the JVM running the tests on some errors. Examples:
> This code prints the stack trace of the underlying error to the terminal, but it won't be included in the report from the JUnit framework:
> 					printStackTrace(sqle);
> 					fail("Unexpected exception from statement '" + sql + "'");
> This code terminates the JVM on error, preventing subsequent tests from running, and also preventing the JUnit framework to report the results from the tests that did run:
> 		} catch (Exception e) {
> 			System.out.println(s + " is not a proper timestamp string.");
> 			System.out.println(e.getClass().getName() + ": " + e.getMessage());
> 			e.printStackTrace();
> 			System.exit(1);
> 			return null;
> 		}

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


[jira] Updated: (DERBY-4665) Unidiomatic error handling in TimestampArithTest

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4665:
--------------------------------------

    Attachment: errors2.diff

Thanks for looking at the patch, Kristian.

I've uploaded a new patch, where the labels have been turned into comments. I don't think they need to be printed, since it should be easy to see which sub-test failed by looking at the stack traces.

Committed revision 946188.

> Unidiomatic error handling in TimestampArithTest
> ------------------------------------------------
>
>                 Key: DERBY-4665
>                 URL: https://issues.apache.org/jira/browse/DERBY-4665
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.7.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.7.0.0
>
>         Attachments: errors.diff, errors2.diff
>
>
> TimestampArithTest contains some error handling code that prevents the underlying error from being reported to the JUnit framework, and it may even terminate the JVM running the tests on some errors. Examples:
> This code prints the stack trace of the underlying error to the terminal, but it won't be included in the report from the JUnit framework:
> 					printStackTrace(sqle);
> 					fail("Unexpected exception from statement '" + sql + "'");
> This code terminates the JVM on error, preventing subsequent tests from running, and also preventing the JUnit framework to report the results from the tests that did run:
> 		} catch (Exception e) {
> 			System.out.println(s + " is not a proper timestamp string.");
> 			System.out.println(e.getClass().getName() + ": " + e.getMessage());
> 			e.printStackTrace();
> 			System.exit(1);
> 			return null;
> 		}

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