You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by se...@apache.org on 2008/05/03 01:49:48 UTC

svn commit: r652950 - in /httpcomponents/httpclient/trunk/module-client/src: main/java/org/apache/http/auth/ main/java/org/apache/http/conn/scheme/ main/java/org/apache/http/conn/ssl/ main/java/org/apache/http/cookie/ main/java/org/apache/http/impl/aut...

Author: sebb
Date: Fri May  2 16:49:48 2008
New Revision: 652950

URL: http://svn.apache.org/viewvc?rev=652950&view=rev
Log:
HTTPCLIENT-765 - String.toLowerCase() / toUpperCase() should specify Locale.ENGLISH

Modified:
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthScope.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/scheme/Scheme.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractAuthenticationHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpec.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/cookie/TestCookiePolicy.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/EchoHandler.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/RandomHandler.java

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java Fri May  2 16:49:48 2008
@@ -33,6 +33,7 @@
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.http.params.HttpParams;
@@ -80,7 +81,7 @@
         if (factory == null) {
             throw new IllegalArgumentException("Authentication scheme factory may not be null");
         }
-        registeredSchemes.put(name.toLowerCase(), factory);
+        registeredSchemes.put(name.toLowerCase(Locale.ENGLISH), factory);
     }
 
     /**
@@ -93,7 +94,7 @@
          if (name == null) {
              throw new IllegalArgumentException("Name may not be null");
          }
-        registeredSchemes.remove(name.toLowerCase());
+        registeredSchemes.remove(name.toLowerCase(Locale.ENGLISH));
     }
 
     /**
@@ -113,7 +114,7 @@
         if (name == null) {
             throw new IllegalArgumentException("Name may not be null");
         }
-        AuthSchemeFactory factory = registeredSchemes.get(name.toLowerCase());
+        AuthSchemeFactory factory = registeredSchemes.get(name.toLowerCase(Locale.ENGLISH));
         if (factory != null) {
             return factory.newInstance(params);
         } else {

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthScope.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthScope.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthScope.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthScope.java Fri May  2 16:49:48 2008
@@ -30,6 +30,8 @@
 
 package org.apache.http.auth;
 
+import java.util.Locale;
+
 import org.apache.http.util.LangUtils;
 
 /** 
@@ -104,10 +106,10 @@
     public AuthScope(final String host, int port, 
         final String realm, final String scheme)
     {
-        this.host =   (host == null)   ? ANY_HOST: host.toLowerCase();
+        this.host =   (host == null)   ? ANY_HOST: host.toLowerCase(Locale.ENGLISH);
         this.port =   (port < 0)       ? ANY_PORT: port;
         this.realm =  (realm == null)  ? ANY_REALM: realm;
-        this.scheme = (scheme == null) ? ANY_SCHEME: scheme.toUpperCase();
+        this.scheme = (scheme == null) ? ANY_SCHEME: scheme.toUpperCase(Locale.ENGLISH);
     }
     
     /** Creates a new credentials scope for the given 
@@ -254,7 +256,7 @@
     public String toString() {
         StringBuffer buffer = new StringBuffer();
         if (this.scheme != null) {
-            buffer.append(this.scheme.toUpperCase());
+            buffer.append(this.scheme.toUpperCase(Locale.ENGLISH));
             buffer.append(' ');
         }
         if (this.realm != null) {

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/scheme/Scheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/scheme/Scheme.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/scheme/Scheme.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/scheme/Scheme.java Fri May  2 16:49:48 2008
@@ -30,6 +30,8 @@
  */
 package org.apache.http.conn.scheme;
 
+import java.util.Locale;
+
 import org.apache.http.util.LangUtils;
 
 /**
@@ -99,7 +101,7 @@
                 ("Port is invalid: " + port);
         }
 
-        this.name = name.toLowerCase();
+        this.name = name.toLowerCase(Locale.ENGLISH);
         this.socketFactory = factory;
         this.defaultPort = port;
         this.layered = (factory instanceof LayeredSocketFactory);

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java Fri May  2 16:49:48 2008
@@ -43,6 +43,7 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.StringTokenizer;
 
 import javax.net.ssl.SSLException;
@@ -178,12 +179,12 @@
 
         // We're can be case-insensitive when comparing the host we used to
         // establish the socket to the hostname in the certificate.
-        String hostName = host.trim().toLowerCase();
+        String hostName = host.trim().toLowerCase(Locale.ENGLISH);
         boolean match = false;
         for(Iterator<String> it = names.iterator(); it.hasNext();) {
             // Don't trim the CN, though!
             String cn = it.next();
-            cn = cn.toLowerCase();
+            cn = cn.toLowerCase(Locale.ENGLISH);
             // Store CN in StringBuffer in case we need to report an error.
             buf.append(" <");
             buf.append(cn);

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java Fri May  2 16:49:48 2008
@@ -30,6 +30,8 @@
  */
 package org.apache.http.cookie;
 
+import java.util.Locale;
+
 /**
  * CookieOrigin class incapsulates details of an origin server that 
  * are relevant when parsing, validating or matching HTTP cookies.
@@ -62,7 +64,7 @@
             throw new IllegalArgumentException(
                     "Path of origin may not be null.");
         }
-        this.host = host.toLowerCase();
+        this.host = host.toLowerCase(Locale.ENGLISH);
         this.port = port;
         if (!path.trim().equals("")) {
             this.path = path;

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java Fri May  2 16:49:48 2008
@@ -34,6 +34,7 @@
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.http.params.HttpParams;
@@ -75,7 +76,7 @@
         if (factory == null) {
             throw new IllegalArgumentException("Cookie spec factory may not be null");
         }
-        registeredSpecs.put(name.toLowerCase(), factory);
+        registeredSpecs.put(name.toLowerCase(Locale.ENGLISH), factory);
     }
 
     /**
@@ -87,7 +88,7 @@
          if (id == null) {
              throw new IllegalArgumentException("Id may not be null");
          }
-         registeredSpecs.remove(id.toLowerCase());
+         registeredSpecs.remove(id.toLowerCase(Locale.ENGLISH));
     }
 
     /**
@@ -107,7 +108,7 @@
         if (name == null) {
             throw new IllegalArgumentException("Name may not be null");
         }
-        CookieSpecFactory factory = registeredSpecs.get(name.toLowerCase());
+        CookieSpecFactory factory = registeredSpecs.get(name.toLowerCase(Locale.ENGLISH));
         if (factory != null) {
             return factory.newInstance(params);
         } else {

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java Fri May  2 16:49:48 2008
@@ -31,6 +31,7 @@
 package org.apache.http.impl.auth;
 
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.http.Header;
@@ -159,7 +160,7 @@
         if (this.params == null) {
             return null;
         }
-        return this.params.get(name.toLowerCase());
+        return this.params.get(name.toLowerCase(Locale.ENGLISH));
     }
 
     /**

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractAuthenticationHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractAuthenticationHandler.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractAuthenticationHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractAuthenticationHandler.java Fri May  2 16:49:48 2008
@@ -35,6 +35,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -97,7 +98,7 @@
             }
             int endIndex = pos;
             String s = buffer.substring(beginIndex, endIndex);
-            map.put(s.toLowerCase(), header);
+            map.put(s.toLowerCase(Locale.ENGLISH), header);
         }
         return map;
     }
@@ -126,7 +127,7 @@
         AuthScheme authScheme = null;
         for (Iterator<String> it = authPrefs.iterator(); it.hasNext(); ) {
             String id = it.next();
-            Header challenge = challenges.get(id.toLowerCase()); 
+            Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH)); 
             if (challenge != null) {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug(id + " authentication scheme selected");

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java Fri May  2 16:49:48 2008
@@ -35,6 +35,7 @@
 import java.io.InterruptedIOException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
@@ -942,7 +943,7 @@
         }
         String id = authScheme.getSchemeName();
 
-        Header challenge = challenges.get(id.toLowerCase());
+        Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH));
         if (challenge == null) {
             throw new AuthenticationException(id + 
                 " authorization challenge expected, but not found");

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java Fri May  2 16:49:48 2008
@@ -33,6 +33,7 @@
 
 import java.util.Date;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.http.cookie.ClientCookie;
@@ -197,7 +198,7 @@
      */
     public void setDomain(String domain) {
         if (domain != null) {
-            cookieDomain = domain.toLowerCase();
+            cookieDomain = domain.toLowerCase(Locale.ENGLISH);
         } else {
             cookieDomain = null;
         }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpec.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpec.java Fri May  2 16:49:48 2008
@@ -33,6 +33,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.http.FormattedHeader;
 import org.apache.http.Header;
@@ -109,7 +110,7 @@
         }
         String headervalue = header.getValue();
         boolean isNetscapeCookie = false; 
-        int i1 = headervalue.toLowerCase().indexOf("expires=");
+        int i1 = headervalue.toLowerCase(Locale.ENGLISH).indexOf("expires=");
         if (i1 != -1) {
             i1 += "expires=".length();
             int i2 = headervalue.indexOf(";", i1);

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java Fri May  2 16:49:48 2008
@@ -33,6 +33,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.http.HeaderElement;
 import org.apache.http.NameValuePair;
@@ -87,7 +88,7 @@
             NameValuePair[] attribs = headerelement.getParameters();
             for (int j = attribs.length - 1; j >= 0; j--) {
                 NameValuePair attrib = attribs[j];
-                String s = attrib.getName().toLowerCase();
+                String s = attrib.getName().toLowerCase(Locale.ENGLISH);
                 
                 cookie.setAttribute(s, attrib.getValue());
                 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java Fri May  2 16:49:48 2008
@@ -30,6 +30,7 @@
  */ 
 package org.apache.http.impl.cookie;
 
+import java.util.Locale;
 import java.util.StringTokenizer;
 
 import org.apache.http.cookie.Cookie;
@@ -76,7 +77,7 @@
     * @return True if the specified domain is "special"
     */
    private static boolean isSpecialDomain(final String domain) {
-       final String ucDomain = domain.toUpperCase();
+       final String ucDomain = domain.toUpperCase(Locale.ENGLISH);
        if (ucDomain.endsWith(".COM") 
           || ucDomain.endsWith(".EDU")
           || ucDomain.endsWith(".NET")

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java Fri May  2 16:49:48 2008
@@ -30,6 +30,8 @@
  */ 
 package org.apache.http.impl.cookie;
 
+import java.util.Locale;
+
 import org.apache.http.cookie.Cookie;
 import org.apache.http.cookie.CookieAttributeHandler;
 import org.apache.http.cookie.CookieOrigin;
@@ -90,7 +92,7 @@
                     + domain 
                     + "\" violates RFC 2109: domain must contain an embedded dot");
             }
-            host = host.toLowerCase();
+            host = host.toLowerCase(Locale.ENGLISH);
             if (!host.endsWith(domain)) {
                 throw new MalformedCookieException(
                     "Illegal domain attribute \"" + domain 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java Fri May  2 16:49:48 2008
@@ -31,6 +31,8 @@
 
 package org.apache.http.impl.cookie;
 
+import java.util.Locale;
+
 import org.apache.http.cookie.ClientCookie;
 import org.apache.http.cookie.Cookie;
 import org.apache.http.cookie.CookieAttributeHandler;
@@ -67,7 +69,7 @@
             throw new MalformedCookieException(
                     "Blank value for domain attribute");
         }
-        domain = domain.toLowerCase();
+        domain = domain.toLowerCase(Locale.ENGLISH);
         if (!domain.startsWith(".")) {
             // Per RFC 2965 section 3.2.2
             // "... If an explicitly specified value does not start with
@@ -112,12 +114,12 @@
         if (origin == null) {
             throw new IllegalArgumentException("Cookie origin may not be null");
         }
-        String host = origin.getHost().toLowerCase();
+        String host = origin.getHost().toLowerCase(Locale.ENGLISH);
         if (cookie.getDomain() == null) {
             throw new MalformedCookieException("Invalid cookie state: " +
                                                "domain not specified");
         }
-        String cookieDomain = cookie.getDomain().toLowerCase();
+        String cookieDomain = cookie.getDomain().toLowerCase(Locale.ENGLISH);
 
         if (cookie instanceof ClientCookie 
                 && ((ClientCookie) cookie).containsAttribute(ClientCookie.DOMAIN_ATTR)) {
@@ -176,7 +178,7 @@
         if (origin == null) {
             throw new IllegalArgumentException("Cookie origin may not be null");
         }
-        String host = origin.getHost().toLowerCase();
+        String host = origin.getHost().toLowerCase(Locale.ENGLISH);
         String cookieDomain = cookie.getDomain();
 
         // The effective host name MUST domain-match the Domain

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java Fri May  2 16:49:48 2008
@@ -33,6 +33,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.http.Header;
@@ -132,11 +133,11 @@
                 new HashMap<String, NameValuePair>(attribs.length); 
             for (int j = attribs.length - 1; j >= 0; j--) {
                 NameValuePair param = attribs[j];
-                attribmap.put(param.getName().toLowerCase(), param);
+                attribmap.put(param.getName().toLowerCase(Locale.ENGLISH), param);
             }
             for (Map.Entry<String, NameValuePair> entry: attribmap.entrySet()) {
                 NameValuePair attrib = entry.getValue();
-                String s = attrib.getName().toLowerCase();
+                String s = attrib.getName().toLowerCase(Locale.ENGLISH);
                 
                 cookie.setAttribute(s, attrib.getValue());
                 

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/cookie/TestCookiePolicy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/cookie/TestCookiePolicy.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/cookie/TestCookiePolicy.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/cookie/TestCookiePolicy.java Fri May  2 16:49:48 2008
@@ -31,6 +31,7 @@
 package org.apache.http.cookie;
 
 import java.util.List;
+import java.util.Locale;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -85,9 +86,9 @@
         names = registry.getSpecNames();
         assertNotNull(names);
         assertEquals(3, names.size());
-        assertEquals(BROWSER_COMPATIBILITY.toLowerCase(), names.get(0));
-        assertEquals(NETSCAPE.toLowerCase(), names.get(1));
-        assertEquals(RFC_2109.toLowerCase(), names.get(2));
+        assertEquals(BROWSER_COMPATIBILITY.toLowerCase(Locale.ENGLISH), names.get(0));
+        assertEquals(NETSCAPE.toLowerCase(Locale.ENGLISH), names.get(1));
+        assertEquals(RFC_2109.toLowerCase(Locale.ENGLISH), names.get(2));
 
         registry.unregister(NETSCAPE); 
         registry.unregister(NETSCAPE); 

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/EchoHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/EchoHandler.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/EchoHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/EchoHandler.java Fri May  2 16:49:48 2008
@@ -32,6 +32,7 @@
 package org.apache.http.localserver;
 
 import java.io.IOException;
+import java.util.Locale;
 
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
@@ -78,7 +79,7 @@
                        final HttpContext context)
         throws HttpException, IOException {
 
-        String method = request.getRequestLine().getMethod().toUpperCase();
+        String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH);
         if (!"GET".equals(method) &&
             !"POST".equals(method) &&
             !"PUT".equals(method)

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/RandomHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/RandomHandler.java?rev=652950&r1=652949&r2=652950&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/RandomHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/RandomHandler.java Fri May  2 16:49:48 2008
@@ -35,6 +35,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.util.Locale;
 
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
@@ -82,7 +83,7 @@
                        final HttpContext context)
         throws HttpException, IOException {
 
-        String method = request.getRequestLine().getMethod().toUpperCase();
+        String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH);
         if (!"GET".equals(method) && !"HEAD".equals(method)) {
             throw new MethodNotSupportedException
                 (method + " not supported by " + getClass().getName());