src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java
changeset 53018 8bf9268df0e2
parent 52427 3c6aa484536c
child 53064 103ed9569fc8
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Dec 13 16:14:07 2018 +0100
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Dec 13 15:31:05 2018 +0100
@@ -1203,7 +1203,7 @@
     synchronized void doneConnect() throws IOException {
         // In server mode, it is not necessary to set host and serverNames.
         // Otherwise, would require a reverse DNS lookup to get the hostname.
-        if ((peerHost == null) || (peerHost.length() == 0)) {
+        if (peerHost == null || peerHost.isEmpty()) {
             boolean useNameService =
                     trustNameService && conContext.sslConfig.isClientMode;
             useImplicitHost(useNameService);
@@ -1238,8 +1238,7 @@
         JavaNetInetAddressAccess jna =
                 SharedSecrets.getJavaNetInetAddressAccess();
         String originalHostname = jna.getOriginalHostName(inetAddress);
-        if ((originalHostname != null) &&
-                (originalHostname.length() != 0)) {
+        if (originalHostname != null && !originalHostname.isEmpty()) {
 
             this.peerHost = originalHostname;
             if (conContext.sslConfig.serverNames.isEmpty() &&