Skip to content

Commit 369ebf7

Browse files
committed
With org.zeromq.ZMQ.Event.recv(socket, DONTWAIT), if they is no more event to receive,
it throws an NPE altought the javadoc says it should return null. Fixed. Also don’t resolve event value for ZMQ_EVENT_MONITOR_STOPPED, it’s a constant.
1 parent bf45bf8 commit 369ebf7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/org/zeromq/ZMQ.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4260,6 +4260,9 @@ private Event(int event, Object value, Object resolvedValue, String address)
42604260
public static Event recv(Socket socket, int flags)
42614261
{
42624262
zmq.ZMQ.Event e = zmq.ZMQ.Event.read(socket.base, flags);
4263+
if (e == null) {
4264+
return null;
4265+
}
42634266
Object resolvedValue;
42644267
switch (e.event) {
42654268
case zmq.ZMQ.ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL:
@@ -4280,6 +4283,7 @@ public static Event recv(Socket socket, int flags)
42804283
break;
42814284
case zmq.ZMQ.ZMQ_EVENT_CONNECT_DELAYED:
42824285
case zmq.ZMQ.ZMQ_EVENT_HANDSHAKE_SUCCEEDED:
4286+
case zmq.ZMQ.ZMQ_EVENT_MONITOR_STOPPED:
42834287
resolvedValue = null;
42844288
break;
42854289
default:

0 commit comments

Comments
 (0)