< prev index next >

src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java

Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb


 126     private SSLSocketFactory sslSocketFactory;
 127 
 128     // HttpClient.proxyDisabled will always be false, because we don't
 129     // use an application-level HTTP proxy.  We might tunnel through
 130     // our http proxy, though.
 131 
 132 
 133     // INSTANCE DATA
 134 
 135     // last negotiated SSL session
 136     private SSLSession  session;
 137 
 138     private String [] getCipherSuites() {
 139         //
 140         // If ciphers are assigned, sort them into an array.
 141         //
 142         String ciphers [];
 143         String cipherString =
 144                 GetPropertyAction.privilegedGetProperty("https.cipherSuites");
 145 
 146         if (cipherString == null || "".equals(cipherString)) {
 147             ciphers = null;
 148         } else {
 149             StringTokenizer     tokenizer;
 150             Vector<String>      v = new Vector<String>();
 151 
 152             tokenizer = new StringTokenizer(cipherString, ",");
 153             while (tokenizer.hasMoreTokens())
 154                 v.addElement(tokenizer.nextToken());
 155             ciphers = new String [v.size()];
 156             for (int i = 0; i < ciphers.length; i++)
 157                 ciphers [i] = v.elementAt(i);
 158         }
 159         return ciphers;
 160     }
 161 
 162     private String [] getProtocols() {
 163         //
 164         // If protocols are assigned, sort them into an array.
 165         //
 166         String protocols [];
 167         String protocolString =
 168                 GetPropertyAction.privilegedGetProperty("https.protocols");
 169 
 170         if (protocolString == null || "".equals(protocolString)) {
 171             protocols = null;
 172         } else {
 173             StringTokenizer     tokenizer;
 174             Vector<String>      v = new Vector<String>();
 175 
 176             tokenizer = new StringTokenizer(protocolString, ",");
 177             while (tokenizer.hasMoreTokens())
 178                 v.addElement(tokenizer.nextToken());
 179             protocols = new String [v.size()];
 180             for (int i = 0; i < protocols.length; i++) {
 181                 protocols [i] = v.elementAt(i);
 182             }
 183         }
 184         return protocols;
 185     }
 186 
 187     private String getUserAgent() {
 188         String userAgent =
 189                 GetPropertyAction.privilegedGetProperty("https.agent");
 190         if (userAgent == null || userAgent.length() == 0) {
 191             userAgent = "JSSE";
 192         }
 193         return userAgent;
 194     }
 195 
 196     // CONSTRUCTOR, FACTORY
 197 
 198 
 199     /**
 200      * Create an HTTPS client URL.  Traffic will be tunneled through any
 201      * intermediate nodes rather than proxied, so that confidentiality
 202      * of data exchanged can be preserved.  However, note that all the
 203      * anonymous SSL flavors are subject to "person-in-the-middle"
 204      * attacks against confidentiality.  If you enable use of those
 205      * flavors, you may be giving up the protection you get through
 206      * SSL tunneling.
 207      *
 208      * Use New to get new HttpsClient. This constructor is meant to be
 209      * used only by New method. New properly checks for URL spoofing.
 210      *




 126     private SSLSocketFactory sslSocketFactory;
 127 
 128     // HttpClient.proxyDisabled will always be false, because we don't
 129     // use an application-level HTTP proxy.  We might tunnel through
 130     // our http proxy, though.
 131 
 132 
 133     // INSTANCE DATA
 134 
 135     // last negotiated SSL session
 136     private SSLSession  session;
 137 
 138     private String [] getCipherSuites() {
 139         //
 140         // If ciphers are assigned, sort them into an array.
 141         //
 142         String ciphers [];
 143         String cipherString =
 144                 GetPropertyAction.privilegedGetProperty("https.cipherSuites");
 145 
 146         if (cipherString == null || cipherString.isEmpty()) {
 147             ciphers = null;
 148         } else {
 149             StringTokenizer     tokenizer;
 150             Vector<String>      v = new Vector<String>();
 151 
 152             tokenizer = new StringTokenizer(cipherString, ",");
 153             while (tokenizer.hasMoreTokens())
 154                 v.addElement(tokenizer.nextToken());
 155             ciphers = new String [v.size()];
 156             for (int i = 0; i < ciphers.length; i++)
 157                 ciphers [i] = v.elementAt(i);
 158         }
 159         return ciphers;
 160     }
 161 
 162     private String [] getProtocols() {
 163         //
 164         // If protocols are assigned, sort them into an array.
 165         //
 166         String protocols [];
 167         String protocolString =
 168                 GetPropertyAction.privilegedGetProperty("https.protocols");
 169 
 170         if (protocolString == null || protocolString.isEmpty()) {
 171             protocols = null;
 172         } else {
 173             StringTokenizer     tokenizer;
 174             Vector<String>      v = new Vector<String>();
 175 
 176             tokenizer = new StringTokenizer(protocolString, ",");
 177             while (tokenizer.hasMoreTokens())
 178                 v.addElement(tokenizer.nextToken());
 179             protocols = new String [v.size()];
 180             for (int i = 0; i < protocols.length; i++) {
 181                 protocols [i] = v.elementAt(i);
 182             }
 183         }
 184         return protocols;
 185     }
 186 
 187     private String getUserAgent() {
 188         String userAgent =
 189                 GetPropertyAction.privilegedGetProperty("https.agent");
 190         if (userAgent == null || userAgent.isEmpty()) {
 191             userAgent = "JSSE";
 192         }
 193         return userAgent;
 194     }
 195 
 196     // CONSTRUCTOR, FACTORY
 197 
 198 
 199     /**
 200      * Create an HTTPS client URL.  Traffic will be tunneled through any
 201      * intermediate nodes rather than proxied, so that confidentiality
 202      * of data exchanged can be preserved.  However, note that all the
 203      * anonymous SSL flavors are subject to "person-in-the-middle"
 204      * attacks against confidentiality.  If you enable use of those
 205      * flavors, you may be giving up the protection you get through
 206      * SSL tunneling.
 207      *
 208      * Use New to get new HttpsClient. This constructor is meant to be
 209      * used only by New method. New properly checks for URL spoofing.
 210      *


< prev index next >