RFR: 5050783: Throwable convenience method: String getStackTraceString()

Claes Redestad claes.redestad at oracle.com
Wed Dec 31 13:32:27 UTC 2014


seems like a reasonable convenience method. :-)

Process stuff: OCA/JSPA signing aside, the patch needs to be submitted 
in its
entirety to some part of the OpenJDK infrastructure before it can be 
Attaching the patch in an e-mail to this mailing list is acceptable for 
a small
patch like this when lacking upload privileges to cr.openjdk.java.net. A 
could help you with the uploading etc.

This request adds a new public method, which means some internal approval
will be necessary. This is something you'll need help with from an Oracle
sponsor. I could volunteer to initiate the requests internally.

Code feedback:

The test relies on the message generated when provoking a division by
zero. I'm not sure this is a good idea nor the place to enforce this
message format with a test. Perhaps just throwing a RuntimeException
with some specified message and test for that?

May I suggest to also add a test to ensure the method behaves well for an
exception with fillInStackTrace overridden to produce stackless exceptions?

Just a thought... I noticed PrintWriter, PrintStream and StringBuilder all
inherit from Appendable, so the PrintStreamOrWriter/StackTracePrinter 
could be replaced with a single StackTraceAppendable taking an 
Appendable. One
static class instead of 1 abstract and 3 concrete static inner classes 
could work
out to be a good deal, but there's some odd mechanics in 
to use the value of the line.separator property at object creation time 
would be hard to support without exposing the lineSeparator fields to 
Perhaps a future consideration.

Performance characteristics might change ever so slightly either way, so it
would be nice with some microbenchmarks to quantify.


On 2014-12-31 11:51, Ivan St. Ivanov wrote:
> Hello,
> I am Ivan from the Bulgarian Java User Group. As part of our Adopt OpenJDK
> efforts, we organized hackathon beginning of this month in Sofia. There we
> worked on the following JIRA issue:
> https://bugs.openjdk.java.net/browse/JDK-5050783
> Unfortunately none of us has author privileges, so the issue is still
> unassigned. But, nevertheless, our JUG has already signed JSPA and some of
> our members (including myself) have signed OCA. And we informed in a
> special email this mailing list about our plans prior to the meeting.
> Our hackathon was already documented by our JUG member Mihail Stoynov:
> http://mihail.stoynov.com/2014/12/12/building-openjdk-and-submitting-a-solution-on-a-feature-request-with-the-bulgarian-java-user-group/
> We used the days after the meeting for offline polishing our contribution
> and adding some more unit tests. Here is the result of our work:
> http://dmitryalexandrov.net/~bgjug/5050783/webrev.00/
> We would be very happy if you are able to review it, share your feedback
> and guide us through the contribution process as this is our first attempt.
> Thanks and have a very successful year!
> Ivan

More information about the core-libs-dev mailing list