diff --git a/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateScheme.java b/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateScheme.java index 7ecf14ab4..f5222c39e 100644 --- a/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateScheme.java +++ b/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateScheme.java @@ -67,7 +67,7 @@ public class WindowsNegotiateScheme extends AuthSchemeBase { public static boolean isAvaliable() { String os = System.getProperty("os.name"); - os = os != null ? os.toLowerCase(Locale.US) : null; + os = os != null ? os.toLowerCase(Locale.ROOT) : null; if (os != null && os.contains("windows")) { try { return Sspi.MAX_TOKEN_SIZE > 0; diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractAuthenticationHandler.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractAuthenticationHandler.java index 74dff36f1..9f211a407 100644 --- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractAuthenticationHandler.java +++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractAuthenticationHandler.java @@ -106,7 +106,7 @@ public abstract class AbstractAuthenticationHandler implements AuthenticationHan } final int endIndex = pos; final String s = buffer.substring(beginIndex, endIndex); - map.put(s.toLowerCase(Locale.US), header); + map.put(s.toLowerCase(Locale.ROOT), header); } return map; } diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AuthenticationStrategyAdaptor.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AuthenticationStrategyAdaptor.java index d23f2d9bc..3f5106f33 100644 --- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AuthenticationStrategyAdaptor.java +++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AuthenticationStrategyAdaptor.java @@ -111,7 +111,7 @@ class AuthenticationStrategyAdaptor implements AuthenticationStrategy { return options; } final String id = authScheme.getSchemeName(); - final Header challenge = challenges.get(id.toLowerCase(Locale.US)); + final Header challenge = challenges.get(id.toLowerCase(Locale.ROOT)); authScheme.processChallenge(challenge); final AuthScope authScope = new AuthScope( diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java index c91fed1ca..280537c60 100644 --- a/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java +++ b/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java @@ -186,12 +186,12 @@ public abstract class AbstractVerifier implements X509HostnameVerifier { // We're can be case-insensitive when comparing the host we used to // establish the socket to the hostname in the certificate. - final String hostName = normaliseIPv6Address(host.trim().toLowerCase(Locale.US)); + final String hostName = normaliseIPv6Address(host.trim().toLowerCase(Locale.ROOT)); boolean match = false; for(final Iterator it = names.iterator(); it.hasNext();) { // Don't trim the CN, though! String cn = it.next(); - cn = cn.toLowerCase(Locale.US); + cn = cn.toLowerCase(Locale.ROOT); // Store CN in StringBuilder in case we need to report an error. buf.append(" <"); buf.append(cn); diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/AuthSchemeBase.java b/httpclient/src/main/java/org/apache/http/impl/auth/AuthSchemeBase.java index a1e89942c..646b3d61e 100644 --- a/httpclient/src/main/java/org/apache/http/impl/auth/AuthSchemeBase.java +++ b/httpclient/src/main/java/org/apache/http/impl/auth/AuthSchemeBase.java @@ -162,7 +162,7 @@ public abstract class AuthSchemeBase implements ContextAwareAuthScheme { public String toString() { final String name = getSchemeName(); if (name != null) { - return name.toUpperCase(Locale.US); + return name.toUpperCase(Locale.ROOT); } else { return super.toString(); } diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java b/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java index d8e71063c..c6ab233ed 100644 --- a/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java +++ b/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java @@ -267,7 +267,7 @@ public class DigestScheme extends RFC2617Scheme { final StringTokenizer tok = new StringTokenizer(qoplist, ","); while (tok.hasMoreTokens()) { final String variant = tok.nextToken().trim(); - qopset.add(variant.toLowerCase(Locale.US)); + qopset.add(variant.toLowerCase(Locale.ROOT)); } if (request instanceof HttpEntityEnclosingRequest && qopset.contains("auth-int")) { qop = QOP_AUTH_INT; diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java b/httpclient/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java index bb4a36e6d..e9787ac90 100644 --- a/httpclient/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java +++ b/httpclient/src/main/java/org/apache/http/impl/auth/HttpAuthenticator.java @@ -131,7 +131,7 @@ public class HttpAuthenticator { case UNCHALLENGED: if (authScheme != null) { final String id = authScheme.getSchemeName(); - final Header challenge = challenges.get(id.toLowerCase(Locale.US)); + final Header challenge = challenges.get(id.toLowerCase(Locale.ROOT)); if (challenge != null) { this.log.debug("Authorization challenge processed"); authScheme.processChallenge(challenge); diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java b/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java index b97af3bcd..b6089e331 100644 --- a/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java +++ b/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java @@ -590,7 +590,7 @@ final class NTLMEngineImpl implements NTLMEngine { */ private static byte[] lmHash(final String password) throws NTLMEngineException { try { - final byte[] oemPassword = password.toUpperCase(Locale.US).getBytes(Consts.ASCII); + final byte[] oemPassword = password.toUpperCase(Locale.ROOT).getBytes(Consts.ASCII); final int length = Math.min(oemPassword.length, 14); final byte[] keyBytes = new byte[14]; System.arraycopy(oemPassword, 0, keyBytes, 0, length); @@ -643,9 +643,9 @@ final class NTLMEngineImpl implements NTLMEngine { } final HMACMD5 hmacMD5 = new HMACMD5(ntlmHash); // Upper case username, upper case domain! - hmacMD5.update(user.toUpperCase(Locale.US).getBytes(UNICODE_LITTLE_UNMARKED)); + hmacMD5.update(user.toUpperCase(Locale.ROOT).getBytes(UNICODE_LITTLE_UNMARKED)); if (domain != null) { - hmacMD5.update(domain.toUpperCase(Locale.US).getBytes(UNICODE_LITTLE_UNMARKED)); + hmacMD5.update(domain.toUpperCase(Locale.ROOT).getBytes(UNICODE_LITTLE_UNMARKED)); } return hmacMD5.getOutput(); } @@ -663,7 +663,7 @@ final class NTLMEngineImpl implements NTLMEngine { } final HMACMD5 hmacMD5 = new HMACMD5(ntlmHash); // Upper case username, mixed case target!! - hmacMD5.update(user.toUpperCase(Locale.US).getBytes(UNICODE_LITTLE_UNMARKED)); + hmacMD5.update(user.toUpperCase(Locale.ROOT).getBytes(UNICODE_LITTLE_UNMARKED)); if (domain != null) { hmacMD5.update(domain.getBytes(UNICODE_LITTLE_UNMARKED)); } @@ -986,7 +986,7 @@ final class NTLMEngineImpl implements NTLMEngine { hostBytes = unqualifiedHost != null? unqualifiedHost.getBytes(Consts.ASCII) : null; domainBytes = unqualifiedDomain != null ? unqualifiedDomain - .toUpperCase(Locale.US).getBytes(Consts.ASCII) : null; + .toUpperCase(Locale.ROOT).getBytes(Consts.ASCII) : null; } /** @@ -1239,7 +1239,7 @@ final class NTLMEngineImpl implements NTLMEngine { } hostBytes = unqualifiedHost != null ? unqualifiedHost.getBytes(UNICODE_LITTLE_UNMARKED) : null; domainBytes = unqualifiedDomain != null ? unqualifiedDomain - .toUpperCase(Locale.US).getBytes(UNICODE_LITTLE_UNMARKED) : null; + .toUpperCase(Locale.ROOT).getBytes(UNICODE_LITTLE_UNMARKED) : null; userBytes = user.getBytes(UNICODE_LITTLE_UNMARKED); } diff --git a/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java b/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java index 951c86b60..90c52d0c2 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java @@ -125,7 +125,7 @@ abstract class AuthenticationStrategyImpl implements AuthenticationStrategy { } final int endIndex = pos; final String s = buffer.substring(beginIndex, endIndex); - map.put(s.toLowerCase(Locale.US), header); + map.put(s.toLowerCase(Locale.ROOT), header); } return map; } @@ -165,7 +165,7 @@ abstract class AuthenticationStrategyImpl implements AuthenticationStrategy { } for (final String id: authPrefs) { - final Header challenge = challenges.get(id.toLowerCase(Locale.US)); + final Header challenge = challenges.get(id.toLowerCase(Locale.ROOT)); if (challenge != null) { final AuthSchemeProvider authSchemeProvider = registry.lookup(id); if (authSchemeProvider == null) { diff --git a/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java b/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java index e1569b820..1b4c7fc22 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java @@ -187,7 +187,7 @@ public class DefaultRedirectStrategy implements RedirectStrategy { final URIBuilder b = new URIBuilder(new URI(location).normalize()); final String host = b.getHost(); if (host != null) { - b.setHost(host.toLowerCase(Locale.US)); + b.setHost(host.toLowerCase(Locale.ROOT)); } final String path = b.getPath(); if (TextUtils.isEmpty(path)) { diff --git a/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java index 914d2ca04..52788ea52 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java @@ -72,7 +72,7 @@ public class StandardHttpRequestRetryHandler extends DefaultHttpRequestRetryHand @Override protected boolean handleAsIdempotent(final HttpRequest request) { - final String method = request.getRequestLine().getMethod().toUpperCase(Locale.US); + final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT); final Boolean b = this.idempotentMethods.get(method); return b != null && b.booleanValue(); } diff --git a/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMinimalClientRequestExecution.java b/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMinimalClientRequestExecution.java index 1b51697f3..f7f1f0cde 100644 --- a/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMinimalClientRequestExecution.java +++ b/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMinimalClientRequestExecution.java @@ -92,7 +92,7 @@ public class TestMinimalClientRequestExecution extends IntegrationTestBase { final Header[] headers = reqWrapper.getAllHeaders(); final Set headerSet = new HashSet(); for (final Header header: headers) { - headerSet.add(header.getName().toLowerCase(Locale.US)); + headerSet.add(header.getName().toLowerCase(Locale.ROOT)); } Assert.assertEquals(3, headerSet.size()); Assert.assertTrue(headerSet.contains("connection")); diff --git a/httpmime/src/main/java/org/apache/http/entity/mime/Header.java b/httpmime/src/main/java/org/apache/http/entity/mime/Header.java index f9783e572..c39dff5b5 100644 --- a/httpmime/src/main/java/org/apache/http/entity/mime/Header.java +++ b/httpmime/src/main/java/org/apache/http/entity/mime/Header.java @@ -54,7 +54,7 @@ public class Header implements Iterable { if (field == null) { return; } - final String key = field.getName().toLowerCase(Locale.US); + final String key = field.getName().toLowerCase(Locale.ROOT); List values = this.fieldMap.get(key); if (values == null) { values = new LinkedList(); @@ -72,7 +72,7 @@ public class Header implements Iterable { if (name == null) { return null; } - final String key = name.toLowerCase(Locale.US); + final String key = name.toLowerCase(Locale.ROOT); final List list = this.fieldMap.get(key); if (list != null && !list.isEmpty()) { return list.get(0); @@ -84,7 +84,7 @@ public class Header implements Iterable { if (name == null) { return null; } - final String key = name.toLowerCase(Locale.US); + final String key = name.toLowerCase(Locale.ROOT); final List list = this.fieldMap.get(key); if (list == null || list.isEmpty()) { return Collections.emptyList(); @@ -97,7 +97,7 @@ public class Header implements Iterable { if (name == null) { return 0; } - final String key = name.toLowerCase(Locale.US); + final String key = name.toLowerCase(Locale.ROOT); final List removed = fieldMap.remove(key); if (removed == null || removed.isEmpty()) { return 0; @@ -110,7 +110,7 @@ public class Header implements Iterable { if (field == null) { return; } - final String key = field.getName().toLowerCase(Locale.US); + final String key = field.getName().toLowerCase(Locale.ROOT); final List list = fieldMap.get(key); if (list == null || list.isEmpty()) { addField(field);