< prev index next >

src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD

*** 434,452 **** if (SSLLogger.isOn && SSLLogger.isOn("ssl,sslctx")) { SSLLogger.fine( "System property " + propertyName + " is set to '" + property + "'"); } ! if (property != null && property.length() != 0) { // remove double quote marks from beginning/end of the property if (property.length() > 1 && property.charAt(0) == '"' && property.charAt(property.length() - 1) == '"') { property = property.substring(1, property.length() - 1); } } ! if (property != null && property.length() != 0) { String[] cipherSuiteNames = property.split(","); Collection<CipherSuite> cipherSuites = new ArrayList<>(cipherSuiteNames.length); for (int i = 0; i < cipherSuiteNames.length; i++) { cipherSuiteNames[i] = cipherSuiteNames[i].trim(); --- 434,452 ---- if (SSLLogger.isOn && SSLLogger.isOn("ssl,sslctx")) { SSLLogger.fine( "System property " + propertyName + " is set to '" + property + "'"); } ! if (property != null && !property.isEmpty()) { // remove double quote marks from beginning/end of the property if (property.length() > 1 && property.charAt(0) == '"' && property.charAt(property.length() - 1) == '"') { property = property.substring(1, property.length() - 1); } } ! if (property != null && !property.isEmpty()) { String[] cipherSuiteNames = property.split(","); Collection<CipherSuite> cipherSuites = new ArrayList<>(cipherSuiteNames.length); for (int i = 0; i < cipherSuiteNames.length; i++) { cipherSuiteNames[i] = cipherSuiteNames[i].trim();
*** 843,861 **** String property = GetPropertyAction.privilegedGetProperty(propname); if (property == null) { return; } ! if (property.length() != 0) { // remove double quote marks from beginning/end of the property if (property.length() > 1 && property.charAt(0) == '"' && property.charAt(property.length() - 1) == '"') { property = property.substring(1, property.length() - 1); } } ! if (property.length() != 0) { String[] protocols = property.split(","); for (int i = 0; i < protocols.length; i++) { protocols[i] = protocols[i].trim(); // Is it a supported protocol name? ProtocolVersion pv = --- 843,861 ---- String property = GetPropertyAction.privilegedGetProperty(propname); if (property == null) { return; } ! if (!property.isEmpty()) { // remove double quote marks from beginning/end of the property if (property.length() > 1 && property.charAt(0) == '"' && property.charAt(property.length() - 1) == '"') { property = property.substring(1, property.length() - 1); } } ! if (!property.isEmpty()) { String[] protocols = property.split(","); for (int i = 0; i < protocols.length; i++) { protocols[i] = protocols[i].trim(); // Is it a supported protocol name? ProtocolVersion pv =
*** 1107,1117 **** FileInputStream fs = null; KeyStore ks = null; char[] passwd = null; try { ! if (defaultKeyStore.length() != 0 && !NONE.equals(defaultKeyStore)) { fs = AccessController.doPrivileged( new PrivilegedExceptionAction<FileInputStream>() { @Override public FileInputStream run() throws Exception { --- 1107,1117 ---- FileInputStream fs = null; KeyStore ks = null; char[] passwd = null; try { ! if (!defaultKeyStore.isEmpty() && !NONE.equals(defaultKeyStore)) { fs = AccessController.doPrivileged( new PrivilegedExceptionAction<FileInputStream>() { @Override public FileInputStream run() throws Exception {
*** 1119,1140 **** } }); } String defaultKeyStorePassword = props.get("keyStorePasswd"); ! if (defaultKeyStorePassword.length() != 0) { passwd = defaultKeyStorePassword.toCharArray(); } /** * Try to initialize key store. */ if ((defaultKeyStoreType.length()) != 0) { if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) { SSLLogger.finest("init keystore"); } ! if (defaultKeyStoreProvider.length() == 0) { ks = KeyStore.getInstance(defaultKeyStoreType); } else { ks = KeyStore.getInstance(defaultKeyStoreType, defaultKeyStoreProvider); } --- 1119,1140 ---- } }); } String defaultKeyStorePassword = props.get("keyStorePasswd"); ! if (!defaultKeyStorePassword.isEmpty()) { passwd = defaultKeyStorePassword.toCharArray(); } /** * Try to initialize key store. */ if ((defaultKeyStoreType.length()) != 0) { if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) { SSLLogger.finest("init keystore"); } ! if (defaultKeyStoreProvider.isEmpty()) { ks = KeyStore.getInstance(defaultKeyStoreType); } else { ks = KeyStore.getInstance(defaultKeyStoreType, defaultKeyStoreProvider); }
*** 1559,1569 **** } // check endpoint identity String identityAlg = sslSocket.getSSLParameters(). getEndpointIdentificationAlgorithm(); ! if (identityAlg != null && identityAlg.length() != 0) { String hostname = session.getPeerHost(); X509TrustManagerImpl.checkIdentity( hostname, chain[0], identityAlg); } --- 1559,1569 ---- } // check endpoint identity String identityAlg = sslSocket.getSSLParameters(). getEndpointIdentificationAlgorithm(); ! if (identityAlg != null && !identityAlg.isEmpty()) { String hostname = session.getPeerHost(); X509TrustManagerImpl.checkIdentity( hostname, chain[0], identityAlg); }
*** 1599,1609 **** } // check endpoint identity String identityAlg = engine.getSSLParameters(). getEndpointIdentificationAlgorithm(); ! if (identityAlg != null && identityAlg.length() != 0) { String hostname = session.getPeerHost(); X509TrustManagerImpl.checkIdentity( hostname, chain[0], identityAlg); } --- 1599,1609 ---- } // check endpoint identity String identityAlg = engine.getSSLParameters(). getEndpointIdentificationAlgorithm(); ! if (identityAlg != null && !identityAlg.isEmpty()) { String hostname = session.getPeerHost(); X509TrustManagerImpl.checkIdentity( hostname, chain[0], identityAlg); }
< prev index next >