File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed
main/java/zmq/io/mechanism/curve Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change 44import static zmq .io .Metadata .SOCKET_TYPE ;
55
66import java .nio .ByteBuffer ;
7+ import java .util .Objects ;
78
89import zmq .Msg ;
910import zmq .Options ;
@@ -510,12 +511,7 @@ private int produceError(Msg msg)
510511 assert (statusCode == null || statusCode .length () == 3 );
511512
512513 msg .putShortString ("ERROR" );
513- if (statusCode != null ) {
514- msg .putShortString (statusCode );
515- }
516- else {
517- msg .putShortString ("" );
518- }
514+ msg .putShortString (Objects .requireNonNullElse (statusCode , "" ));
519515
520516 return 0 ;
521517 }
Original file line number Diff line number Diff line change 22
33import java .util .HashMap ;
44import java .util .Map ;
5+ import java .util .Objects ;
56
67import org .zeromq .*;
78import org .zeromq .ZMQ .Poller ;
@@ -206,9 +207,7 @@ else if (command.equals("CONNECT")) {
206207 else if (command .equals ("GET" )) {
207208 String key = msg .popString ();
208209 String value = kvmap .get (key );
209- if (value != null )
210- pipe .send (value );
211- else pipe .send ("" );
210+ pipe .send (Objects .requireNonNullElse (value , "" ));
212211 }
213212 msg .destroy ();
214213
You can’t perform that action at this time.
0 commit comments