You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2014/04/11 21:30:51 UTC

svn commit: r1586757 - in /httpcomponents/httpasyncclient/trunk/httpasyncclient/src: main/java-deprecated/org/apache/http/nio/conn/scheme/ test/java/org/apache/http/localserver/

Author: olegk
Date: Fri Apr 11 19:30:51 2014
New Revision: 1586757

URL: http://svn.apache.org/r1586757
Log:
Use Locale#ROOT instead of Locale#ENGLISH or Locale#US for lower / upper case conversions

Modified:
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/AsyncScheme.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/localserver/EchoHandler.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/localserver/RandomHandler.java

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/AsyncScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/AsyncScheme.java?rev=1586757&r1=1586756&r2=1586757&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/AsyncScheme.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/AsyncScheme.java Fri Apr 11 19:30:51 2014
@@ -56,7 +56,7 @@ public final class AsyncScheme {
         if ((port <= 0) || (port > 0xffff)) {
             throw new IllegalArgumentException("Port is invalid: " + port);
         }
-        this.name = name.toLowerCase(Locale.ENGLISH);
+        this.name = name.toLowerCase(Locale.ROOT);
         this.strategy = strategy;
         this.defaultPort = port;
     }

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/localserver/EchoHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/localserver/EchoHandler.java?rev=1586757&r1=1586756&r2=1586757&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/localserver/EchoHandler.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/localserver/EchoHandler.java Fri Apr 11 19:30:51 2014
@@ -65,7 +65,7 @@ public class EchoHandler
                        final HttpContext context)
         throws HttpException, IOException {
 
-        final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH);
+        final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT);
         if (!"GET".equals(method) &&
             !"POST".equals(method) &&
             !"PUT".equals(method)

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/localserver/RandomHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/localserver/RandomHandler.java?rev=1586757&r1=1586756&r2=1586757&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/localserver/RandomHandler.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/localserver/RandomHandler.java Fri Apr 11 19:30:51 2014
@@ -31,6 +31,7 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.Locale;
 
+import org.apache.http.Consts;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
@@ -48,15 +49,9 @@ public class RandomHandler implements Ht
 
     private final static byte[] RANGE;
     static {
-        byte[] range = null;
-        try {
-            range = ("abcdefghijklmnopqrstuvwxyz" +
-                     "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789"
-                ).getBytes("US-ASCII");
-        } catch (final UnsupportedEncodingException uex) {
-            // never, US-ASCII is guaranteed
-        }
-        RANGE = range;
+        RANGE = ("abcdefghijklmnopqrstuvwxyz" +
+                "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789"
+        ).getBytes(Consts.ASCII);
     }
 
     /**
@@ -79,7 +74,7 @@ public class RandomHandler implements Ht
                        final HttpContext context)
         throws HttpException, IOException {
 
-        final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH);
+        final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT);
         if (!"GET".equals(method) && !"HEAD".equals(method)) {
             throw new MethodNotSupportedException
                 (method + " not supported by " + getClass().getName());