You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RubyUDPSocket.java:483:in `doReceiveMulticast': java.lang.NullPointerException
from RubyUDPSocket.java:407:in `doReceiveTuple'
from RubyUDPSocket.java:350:in `recvfrom'
from MethodHandle.java:599:in `invokeWithArguments'
from InvocationLinker.java:153:in `invocationFallback'
from /tmp/udp.rb:9:in `__file__'
from /tmp/udp.rb:-1:in `load'
from Ruby.java:807:in `runScript'
from Ruby.java:800:in `runScript'
from Ruby.java:669:in `runNormally'
from Ruby.java:518:in `runFromMain'
from Main.java:390:in `doRunFromMain'
from Main.java:279:in `internalRun'
from Main.java:221:in `run'
from Main.java:201:in `main'
The text was updated successfully, but these errors were encountered:
RubyUDPSocket.java:483:in `doReceiveMulticast': java.lang.NullPointerException
from RubyUDPSocket.java:407:in `doReceiveTuple'
from RubyUDPSocket.java:350:in `recvfrom'
from RubyIPSocket$INVOKER$i$recvfrom.gen:-1:in `call'
from CachingCallSite.java:326:in `cacheAndCall'
from CachingCallSite.java:170:in `call'
from npe.rb:9:in `__file__'
from npe.rb:-1:in `load'
from Ruby.java:813:in `runScript'
from Ruby.java:806:in `runScript'
from Ruby.java:675:in `runNormally'
from Ruby.java:524:in `runFromMain'
from Main.java:390:in `doRunFromMain'
from Main.java:279:in `internalRun'
from Main.java:221:in `run'
from Main.java:201:in `main'
So this NPE is caused by the 'multicastSocket' member of RubyBasicSocket's MulticastStateManager being null. The multicaseSocket is assigned only when MulticastStateManager::rebindToPort is called. This, in turn, is called from RubyUDPSocket in send and bind. In the code above, a call to 'bind' should be used before calling recvfrom, but maybe a more helpful exception would be good here?
Though it Would Be Nice If (tm) we threw an informative IllegalStateException or something when an unbound socket is used.
For reference, the current ruby-2.0.0 just hangs when presented with an unbound socket calling recvfrom - probably an implementation detail of the underlying sockets library.
The following code snippet (extracted from test/test_socket.rb) will raise java.lang.NullPointerException:
The text was updated successfully, but these errors were encountered: