On 01/10/2013 13:37, Daniel Fuchs wrote:

Hi Seán,

This looks simpler and better :-)

However I wonder, do you still need to catch NPE
in CustomSocketImplFactory.main ?
Daniel,

Since I'm only creating a dummy socketImpl to test the classcastexception, no real networking stack is in place here. I'm catching the NPE that would be thrown from the native Java_java_net_TwoStacksPlainSocketImpl_socketAccept function since the underlying socket passed to it is null.

C:\tmp>java CustomSocketImplFactory
Created Socket[addr=null,port=0,localport=0]
Exception in thread "main" java.lang.NullPointerException: socket is null
        at java.net.TwoStacksPlainSocketImpl.socketAccept(Native Method)

Regards,
Sean.


Or is that going to hide future bugs?

best regards

-- daniel (not a reviewer)

Reply via email to