http-client-branch: review comment - specify locale consistently in toLowerCase http-client-branch
authorchegar
Mon, 09 Apr 2018 15:10:48 +0100
branchhttp-client-branch
changeset 56402 5c29612f27b4
parent 56401 84a8fa684998
child 56404 f14bec8e8d8e
http-client-branch: review comment - specify locale consistently in toLowerCase
src/java.net.http/share/classes/jdk/internal/net/http/HeaderParser.java
src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java
src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestBuilderImpl.java
src/java.net.http/share/classes/jdk/internal/net/http/common/Log.java
--- a/src/java.net.http/share/classes/jdk/internal/net/http/HeaderParser.java	Mon Apr 09 12:59:06 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/HeaderParser.java	Mon Apr 09 15:10:48 2018 +0100
@@ -142,7 +142,7 @@
                         tab[i++][1] = (new String(ca, beg, end-beg+1));
                     }
                 } else {
-                    tab[i++][0] = (new String(ca, beg, end-beg+1)).toLowerCase();
+                    tab[i++][0] = (new String(ca, beg, end-beg+1)).toLowerCase(Locale.US);
                 }
             } else if (end == beg) {
                 if (!inKey) {
@@ -152,7 +152,7 @@
                         tab[i++][1] = String.valueOf(ca[end]);
                     }
                 } else {
-                    tab[i++][0] = String.valueOf(ca[end]).toLowerCase();
+                    tab[i++][0] = String.valueOf(ca[end]).toLowerCase(Locale.US);
                 }
             }
             nkeys=i;
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java	Mon Apr 09 12:59:06 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java	Mon Apr 09 15:10:48 2018 +0100
@@ -36,6 +36,7 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.CompletableFuture;
@@ -426,7 +427,7 @@
 
         return keyString(isSecure, isProxy, addr.getHostString(), addr.getPort());
     }
-    
+
     static String keyFor(URI uri, InetSocketAddress proxy) {
         boolean isSecure = uri.getScheme().equalsIgnoreCase("https");
         boolean isProxy = proxy != null;
@@ -960,7 +961,7 @@
         List<ByteBuffer> buffers = new ArrayList<>();
         for(HttpHeaders header : headers) {
             for (Map.Entry<String, List<String>> e : header.map().entrySet()) {
-                String lKey = e.getKey().toLowerCase();
+                String lKey = e.getKey().toLowerCase(Locale.US);
                 List<String> values = e.getValue();
                 for (String value : values) {
                     hpackOut.header(lKey, value);
--- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestBuilderImpl.java	Mon Apr 09 12:59:06 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestBuilderImpl.java	Mon Apr 09 15:10:48 2018 +0100
@@ -27,6 +27,7 @@
 
 import java.net.URI;
 import java.time.Duration;
+import java.util.Locale;
 import java.util.Optional;
 import java.net.http.HttpClient;
 import java.net.http.HttpRequest;
@@ -76,7 +77,7 @@
         String scheme = uri.getScheme();
         if (scheme == null)
             throw newIAE("URI with undefined scheme");
-        scheme = scheme.toLowerCase();
+        scheme = scheme.toLowerCase(Locale.US);
         if (!(scheme.equals("https") || scheme.equals("http"))) {
             throw newIAE("invalid URI scheme %s", scheme);
         }
--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/Log.java	Mon Apr 09 12:59:06 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/Log.java	Mon Apr 09 15:10:48 2018 +0100
@@ -115,7 +115,7 @@
                         frametypes = CONTROL | DATA | WINDOW_UPDATES;
                     } else {
                         for (String type : types) {
-                            switch (type.toLowerCase()) {
+                            switch (type.toLowerCase(Locale.US)) {
                                 case "control":
                                     frametypes |= CONTROL;
                                     break;