Open EzxD opened 2 years ago
Reason for the change Code smell is important for better readability
Description I replaced stuff which can be expressed with isEmpty(). And a try with resource for closing the socket if exception gets thrown
Code examples I replaced raw.size() == 0 with raw.isEmpty() more important is the try with resource of the socket. old code:
raw.size() == 0
raw.isEmpty()
SSLSocket sslSocket = (SSLSocket) sslContext.getSocketFactory().createSocket( socket, socket.getInetAddress().getHostAddress(), socket.getPort(), true); // replace input/output streams inputStream = new DataInputStream(sslSocket.getInputStream()); outputStream = sslSocket.getOutputStream(); // execute SSL handshake sslSocket.startHandshake();
new code:
try ( SSLSocket sslSocket = (SSLSocket) sslContext.getSocketFactory() .createSocket( socket, socket.getInetAddress().getHostAddress(), socket.getPort(), true ) ) { // replace input/output streams inputStream = new DataInputStream(sslSocket.getInputStream()); outputStream = sslSocket.getOutputStream(); // execute SSL handshake sslSocket.startHandshake(); }
Checklist
References Anything else related to the change e.g. documentations, RFCs, etc.
Reason for the change Code smell is important for better readability
Description I replaced stuff which can be expressed with isEmpty(). And a try with resource for closing the socket if exception gets thrown
Code examples I replaced
raw.size() == 0
withraw.isEmpty()
more important is the try with resource of the socket. old code:new code:
Checklist
References Anything else related to the change e.g. documentations, RFCs, etc.