On 10/1/13 3:09 PM, Seán Coffey wrote:
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)
That's what I would have expected from your previous changeset.
But you're no longer passing null - right? Now you're passing
an instance of CustomSocketImpl.
So where does the NPE come from? Could it be because you should
be calling:
ServerSocket.setSocketImplFactory(new CustomSocketImplFactory());
and not:
Socket.setSocketImplFactory(new CustomSocketImplFactory()); ?
Or should you call both?
best regards,
-- daniel
Regards,
Sean.
Or is that going to hide future bugs?
best regards
-- daniel (not a reviewer)