8215281: Use String.isEmpty() when applicable in java.base

Reviewed-by: dfuchs, alanb
This commit is contained in:
Claes Redestad 2018-12-13 15:31:05 +01:00
parent c998ead188
commit a3df1d618e
155 changed files with 340 additions and 382 deletions

View file

@ -1203,7 +1203,7 @@ public final class SSLSocketImpl
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 @@ public final class SSLSocketImpl
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() &&