Code Review request: 8047186: jdk.net.Sockets throws InvocationTargetException instead of original runtime exceptions

Michael McMahon michael.x.mcmahon at oracle.com
Wed Jun 18 14:28:52 UTC 2014


On 18/06/14 13:53, Artem Smotrakov wrote:
> Hello,
>
> Please review this fix for 8u:
>
> https://bugs.openjdk.java.net/browse/JDK-8047186
> http://cr.openjdk.java.net/~asmotrak/so_flow_sla/sockets_exceptions/webrev.01/ 
>
>
> getOption() and setOption() methods of jdk.net.Sockets class throw 
> InvocationTargetException instead of actual runtime exceptions like 
> NullPointerException and AccessControlException. I think it is better 
> to throw an original runtime exception to reduce and simplify stack 
> traces.
>
> jdk/net/Sockets/Test.java should have caught the issue, but currently 
> it fails due to https://bugs.openjdk.java.net/browse/JDK-8047187. 
> That's why I didn't added separate test for this bug.
>
> Artem

I think what you're saying is that we are currently wrapping all 
RuntimeExceptions in a new non-specific
RuntimeException, and it's just better to throw the original exception.

Seems reasonable to me.

Michael.


More information about the net-dev mailing list