tobous opened a new pull request, #75: URL: https://github.com/apache/db-jdo/pull/75
This PR changes the behavior of `toString()` and `printStackTrace(...)`. To avoid duplication in the `printStackTrace()`, the nested exceptions are no longer printed as part of the `toString()`. If the duplication are acceptable, another alternative keeping the print of nested exceptions as part of the `toString()` is also provided below. Here is a comparison of the behaviors: **Old behavior:** `toString()`: ```java javax.jdo.JDOException: failed NestedThrowables: java.lang.IllegalArgumentException: e1 java.lang.NullPointerException: e2 java.lang.RuntimeException: e3 ``` `printStackTrace(...)`: ```java Exception in thread "main" javax.jdo.JDOException: failed at javax.jdo.util.TestTest.main(TestTest.java:14) NestedThrowablesStackTrace: java.lang.IllegalArgumentException: e1 at javax.jdo.util.TestTest.main(TestTest.java:8) java.lang.NullPointerException: e2 at javax.jdo.util.TestTest.main(TestTest.java:9) java.lang.RuntimeException: e3 at javax.jdo.util.TestTest.main(TestTest.java:10) ``` **New behavior introduced in this PR:** `toString()`: ```java javax.jdo.JDOException: failed ``` `printStackTrace(...)`: ```java Exception in thread "main" javax.jdo.JDOException: failed at javax.jdo.util.TestTest.main(TestTest.java:14) Caused by: java.lang.IllegalArgumentException: e1 at javax.jdo.util.TestTest.main(TestTest.java:8) NestedThrowablesStackTrace: java.lang.NullPointerException: e2 at javax.jdo.util.TestTest.main(TestTest.java:9) java.lang.RuntimeException: e3 at javax.jdo.util.TestTest.main(TestTest.java:10) ``` **Alternative new behavior with duplicate entries:** `toString()`: ```java javax.jdo.JDOException: failed NestedThrowables: java.lang.IllegalArgumentException: e1 java.lang.NullPointerException: e2 java.lang.RuntimeException: e3 ``` `printStackTrace(...)`: ```java Exception in thread "main" javax.jdo.JDOException: failed NestedThrowables: java.lang.IllegalArgumentException: e1 java.lang.NullPointerException: e2 java.lang.RuntimeException: e3 at javax.jdo.util.TestTest.main(TestTest.java:14) Caused by: java.lang.IllegalArgumentException: e1 at javax.jdo.util.TestTest.main(TestTest.java:8) NestedThrowablesStackTrace: java.lang.NullPointerException: e2 at javax.jdo.util.TestTest.main(TestTest.java:9) java.lang.RuntimeException: e3 at javax.jdo.util.TestTest.main(TestTest.java:10) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jdo-dev-unsubscr...@db.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org