From d9dcb1e583c7a58fe4b99369baf62f227b8cdbee Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Mon, 28 Nov 2011 20:32:23 +0000
Subject: [PATCH]   * Specify locale in all toLowerCase() and toUpperCase()
 calls to     avoid "Turkish four i problem"

---
 apps/BOB/src/net/i2p/BOB/DoCMDS.java          |  3 ++-
 apps/BOB/src/net/i2p/BOB/TCPtoI2P.java        |  3 ++-
 .../net/i2p/addressbook/ConfigIterator.java   |  3 ++-
 .../src/net/i2p/addressbook/ConfigParser.java |  3 ++-
 .../src/org/klomp/snark/TrackerClient.java    |  3 ++-
 .../org/klomp/snark/web/I2PSnarkServlet.java  |  9 ++++----
 .../java/src/net/i2p/i2ptunnel/I2PTunnel.java |  3 ++-
 .../i2p/i2ptunnel/I2PTunnelConnectClient.java |  7 +++---
 .../i2p/i2ptunnel/I2PTunnelHTTPClient.java    | 22 +++++++++----------
 .../i2p/i2ptunnel/irc/DCCClientManager.java   |  3 ++-
 .../src/net/i2p/i2ptunnel/irc/IRCFilter.java  |  7 +++---
 .../i2p/i2ptunnel/socks/SOCKS4aServer.java    |  5 +++--
 .../net/i2p/i2ptunnel/socks/SOCKS5Server.java |  3 ++-
 .../src/net/i2p/i2ptunnel/web/IndexBean.java  |  5 +++--
 .../i2p/router/web/ConfigClientsHandler.java  |  5 +++--
 .../src/net/i2p/router/web/NetDbRenderer.java |  4 ++--
 .../java/src/i2p/susi/dns/AddressBean.java    |  3 ++-
 .../src/i2p/susi/dns/AddressbookBean.java     |  3 ++-
 .../src/i2p/susi/dns/NamingServiceBean.java   |  5 +++--
 .../src/src/i2p/susi/webmail/Mail.java        |  2 +-
 .../src/src/i2p/susi/webmail/MailPart.java    | 19 ++++++++--------
 .../src/i2p/susi/webmail/RequestWrapper.java  |  5 +++--
 .../src/src/i2p/susi/webmail/WebMail.java     |  3 ++-
 .../src/net/i2p/apps/systray/UrlLauncher.java |  7 +++---
 .../freenet/support/CPUInformation/CPUID.java | 13 ++++++-----
 .../net/i2p/client/I2CPSSLSocketFactory.java  |  3 ++-
 .../client/naming/BlockfileNamingService.java | 11 +++++-----
 .../i2p/client/naming/DummyNamingService.java |  3 ++-
 .../naming/EepGetAndAddNamingService.java     |  3 ++-
 .../client/naming/EepGetNamingService.java    |  3 ++-
 .../i2p/client/naming/ExecNamingService.java  |  5 +++--
 .../client/naming/HostsTxtNamingService.java  |  9 ++++----
 .../i2p/client/naming/MetaNamingService.java  |  3 ++-
 core/java/src/net/i2p/data/DataHelper.java    |  3 ++-
 core/java/src/net/i2p/time/Timestamper.java   |  2 +-
 core/java/src/net/i2p/util/ConvertToHash.java |  4 +++-
 core/java/src/net/i2p/util/EepGet.java        |  5 +++--
 core/java/src/net/i2p/util/Log.java           |  4 +++-
 core/java/src/net/i2p/util/LogManager.java    |  7 +++---
 .../src/net/i2p/util/NativeBigInteger.java    | 11 +++++-----
 core/java/src/net/i2p/util/SSLEepGet.java     |  3 ++-
 router/java/src/net/i2p/router/Router.java    |  3 ++-
 .../kademlia/PersistentDataStore.java         |  5 +++--
 .../net/i2p/router/peermanager/DBHistory.java |  3 ++-
 .../i2p/router/peermanager/PeerManager.java   |  3 ++-
 .../transport/CommSystemFacadeImpl.java       |  3 ++-
 .../src/net/i2p/router/transport/GeoIP.java   |  5 +++--
 .../i2p/router/transport/TransportImpl.java   |  3 ++-
 .../src/org/cybergarage/http/HTTPHeader.java  |  5 +++--
 .../src/org/cybergarage/util/FileUtil.java    |  9 ++++----
 50 files changed, 157 insertions(+), 109 deletions(-)

diff --git a/apps/BOB/src/net/i2p/BOB/DoCMDS.java b/apps/BOB/src/net/i2p/BOB/DoCMDS.java
index e070826d05..fd53efd695 100644
--- a/apps/BOB/src/net/i2p/BOB/DoCMDS.java
+++ b/apps/BOB/src/net/i2p/BOB/DoCMDS.java
@@ -29,6 +29,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
 import java.net.Socket;
+import java.util.Locale;
 import java.util.Properties;
 import java.util.StringTokenizer;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -434,7 +435,7 @@ public class DoCMDS implements Runnable {
 							if (token.countTokens() != 0) {
 								Command = token.nextToken();
 								Command =
-									Command.toLowerCase();
+									Command.toLowerCase(Locale.US);
 								if (token.countTokens() != 0) {
 									Arg = token.nextToken();
 								} else {
diff --git a/apps/BOB/src/net/i2p/BOB/TCPtoI2P.java b/apps/BOB/src/net/i2p/BOB/TCPtoI2P.java
index 0e00f1c50e..42fe599e8b 100644
--- a/apps/BOB/src/net/i2p/BOB/TCPtoI2P.java
+++ b/apps/BOB/src/net/i2p/BOB/TCPtoI2P.java
@@ -30,6 +30,7 @@ import java.io.OutputStream;
 import java.net.ConnectException;
 import java.net.NoRouteToHostException;
 import java.net.Socket;
+import java.util.Locale;
 import java.util.concurrent.atomic.AtomicBoolean;
 import net.i2p.I2PException;
 import net.i2p.client.streaming.I2PSocket;
@@ -144,7 +145,7 @@ public class TCPtoI2P implements Runnable {
 				in = sock.getInputStream();
 				out = sock.getOutputStream();
 				line = lnRead(in);
-				input = line.toLowerCase();
+				input = line.toLowerCase(Locale.US);
 				Destination dest = null;
 				if (input.endsWith(".i2p")) {
 					//dest = I2PTunnel.destFromName(input);
diff --git a/apps/addressbook/java/src/net/i2p/addressbook/ConfigIterator.java b/apps/addressbook/java/src/net/i2p/addressbook/ConfigIterator.java
index 961c57409b..044f41c3c8 100644
--- a/apps/addressbook/java/src/net/i2p/addressbook/ConfigIterator.java
+++ b/apps/addressbook/java/src/net/i2p/addressbook/ConfigIterator.java
@@ -27,6 +27,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.Map;
 import java.util.NoSuchElementException;
 
@@ -71,7 +72,7 @@ class ConfigIterator implements Iterator<Map.Entry<String, String>> {
                 inputLine = ConfigParser.stripComments(inputLine);
                 String[] splitLine = inputLine.split("=");
                 if (splitLine.length == 2) {
-                    next = new ConfigEntry(splitLine[0].trim().toLowerCase(), splitLine[1].trim());
+                    next = new ConfigEntry(splitLine[0].trim().toLowerCase(Locale.US), splitLine[1].trim());
                     return true;
                 }
                 inputLine = input.readLine();
diff --git a/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java b/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java
index b09804f23a..9e70ee5e14 100644
--- a/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java
+++ b/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java
@@ -32,6 +32,7 @@ import java.io.StringReader;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import net.i2p.util.SecureFile;
@@ -92,7 +93,7 @@ class ConfigParser {
             inputLine = ConfigParser.stripComments(inputLine);
             String[] splitLine = inputLine.split("=");
             if (splitLine.length == 2) {
-                result.put(splitLine[0].trim().toLowerCase(), splitLine[1].trim());
+                result.put(splitLine[0].trim().toLowerCase(Locale.US), splitLine[1].trim());
             }
             inputLine = input.readLine();
         }
diff --git a/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java b/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java
index 85a39f748d..3f7c6b8bd1 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java
@@ -30,6 +30,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Random;
 import java.util.Set;
 
@@ -325,7 +326,7 @@ public class TrackerClient extends I2PAppThread
                     // don't show secondary tracker problems to the user
                     if (tr.isPrimary)
                       snark.setTrackerProblems(tr.trackerProblems);
-                    if (tr.trackerProblems.toLowerCase().startsWith(NOT_REGISTERED)) {
+                    if (tr.trackerProblems.toLowerCase(Locale.US).startsWith(NOT_REGISTERED)) {
                       // Give a guy some time to register it if using opentrackers too
                       if (trackers.size() == 1) {
                         stop = true;
diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
index b2233a14ee..e91ceb5da1 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
@@ -14,6 +14,7 @@ import java.util.Comparator;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
@@ -727,10 +728,10 @@ public class I2PSnarkServlet extends Default {
                 l = l.substring(skip.length());
             if (r.startsWith(skip))
                 r = r.substring(skip.length());
-            String llc = l.toLowerCase();
+            String llc = l.toLowerCase(Locale.US);
             if (llc.startsWith("the ") || llc.startsWith("the.") || llc.startsWith("the_"))
                 l = l.substring(4);
-            String rlc = r.toLowerCase();
+            String rlc = r.toLowerCase(Locale.US);
             if (rlc.startsWith("the ") || rlc.startsWith("the.") || rlc.startsWith("the_"))
                 r = r.substring(4);
             return collator.compare(l, r);
@@ -1836,7 +1837,7 @@ public class I2PSnarkServlet extends Default {
             if (complete) {
                 buf.append("<a href=\"").append(path).append("\">");
                 // thumbnail ?
-                String plc = item.toString().toLowerCase();
+                String plc = item.toString().toLowerCase(Locale.US);
                 if (plc.endsWith(".jpg") || plc.endsWith(".jpeg") || plc.endsWith(".png") ||
                     plc.endsWith(".gif") || plc.endsWith(".ico")) {
                     buf.append("<img alt=\"\" border=\"0\" class=\"thumb\" src=\"")
@@ -1916,7 +1917,7 @@ public class I2PSnarkServlet extends Default {
         // instead of this mishmash. We can't get to HttpContext.setMimeMapping()
         // from here? We could do it from a web.xml perhaps.
         // Or could we put our own org/mortbay/http/mime.properties file in the war?
-        String plc = path.toLowerCase();
+        String plc = path.toLowerCase(Locale.US);
         String mime = getServletContext().getMimeType(path);
         if (mime == null)
             mime = "";
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java
index 056b58822a..d31b8c3d11 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java
@@ -46,6 +46,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
@@ -233,7 +234,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
     public void runCommand(String cmd, Logging l) {
         if (cmd.indexOf(" ") == -1) cmd += " ";
         int iii = cmd.indexOf(" ");
-        String cmdname = cmd.substring(0, iii).toLowerCase();
+        String cmdname = cmd.substring(0, iii).toLowerCase(Locale.US);
         String allargs = cmd.substring(iii + 1);
         String[] args = split(allargs, " "); // .split(" "); // java 1.4
 
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java
index 37b7f8e454..df4f29594f 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java
@@ -11,6 +11,7 @@ import java.net.Socket;
 import java.net.SocketException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
@@ -193,7 +194,7 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
                         restofline = request.substring(pos); // ":80 HTTP/1.1" or " HTTP/1.1"
                     }
 
-                    if (host.toLowerCase().endsWith(".i2p")) {
+                    if (host.toLowerCase(Locale.US).endsWith(".i2p")) {
                         // Destination gets the host name
                         destination = host;
                     } else if (host.indexOf(".") != -1) {
@@ -209,7 +210,7 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
                         destination = currentProxy;
                         usingWWWProxy = true;
                         newRequest.append("CONNECT ").append(host).append(restofline).append("\r\n"); // HTTP spec
-                    } else if (host.toLowerCase().equals("localhost")) {
+                    } else if (host.toLowerCase(Locale.US).equals("localhost")) {
                         writeErrorMessage(ERR_LOCALHOST, out);
                         s.close();
                         return;
@@ -224,7 +225,7 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
                         _log.debug(getPrefix(requestId) + "REST  :" + restofline + ":");
                         _log.debug(getPrefix(requestId) + "DEST  :" + destination + ":");
                     }
-                } else if (line.toLowerCase().startsWith("proxy-authorization: basic ")) {
+                } else if (line.toLowerCase(Locale.US).startsWith("proxy-authorization: basic ")) {
                     // strip Proxy-Authenticate from the response in HTTPResponseOutputStream
                     // save for auth check below
                     authorization = line.substring(27);  // "proxy-authorization: basic ".length()
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
index 3c413bbead..0531b0791e 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
@@ -336,7 +336,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
                 if (_log.shouldLog(Log.DEBUG))
                     _log.debug(getPrefix(requestId) + "Line=[" + line + "]");
 
-                String lowercaseLine = line.toLowerCase();
+                String lowercaseLine = line.toLowerCase(Locale.US);
                 if (lowercaseLine.startsWith("connection: ") ||
                     lowercaseLine.startsWith("keep-alive: ") ||
                     lowercaseLine.startsWith("proxy-connection: "))
@@ -365,7 +365,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
                         }
                         // "http://" + "foo.i2p/bar/baz.html" + " HTTP/1.0"
                         request = "http://" + uri + subRequest.substring(protopos);
-                    } else if (request.toLowerCase().startsWith("http://i2p/")) {
+                    } else if (request.toLowerCase(Locale.US).startsWith("http://i2p/")) {
                         // http://i2p/b64key/bar/baz.html HTTP/1.0
                         String subRequest = request.substring("http://i2p/".length());
                         int protopos = subRequest.indexOf(" ");
@@ -433,11 +433,11 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
                         destination = host;
                         host = getHostName(destination);
                         line = method + ' ' + request.substring(pos);
-                    } else if (host.toLowerCase().equals(LOCAL_SERVER)) {
+                    } else if (host.toLowerCase(Locale.US).equals(LOCAL_SERVER)) {
                         // so we don't do any naming service lookups
                         destination = host;
                         usingInternalServer = true;
-                    } else if (host.toLowerCase().endsWith(".i2p")) {
+                    } else if (host.toLowerCase(Locale.US).endsWith(".i2p")) {
                         // Destination gets the host name
                         destination = host;
                         // Host becomes the destination's "{b32}.b32.i2p" string, or "i2p" on lookup failure
@@ -498,7 +498,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
                                         if (host == null || "i2p".equals(host)) {
                                             // Host lookup failed - resolvable only with addresshelper
                                             // Store in local HashMap unless there is conflict
-                                            String old = addressHelpers.putIfAbsent(destination.toLowerCase(), ahelperKey);
+                                            String old = addressHelpers.putIfAbsent(destination.toLowerCase(Locale.US), ahelperKey);
                                             ahelperNew = old == null;
                                             if ((!ahelperNew) && !old.equals(ahelperKey)) {
                                                 // Conflict: handle when URL reconstruction done
@@ -570,7 +570,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
                         line = method + " " + request.substring(pos);
                         // end of (host endsWith(".i2p"))
 
-                    } else if (host.toLowerCase().equals("localhost") || host.equals("127.0.0.1") ||
+                    } else if (host.toLowerCase(Locale.US).equals("localhost") || host.equals("127.0.0.1") ||
                                host.startsWith("192.168.")) {
                         // if somebody is trying to get to 192.168.example.com, oh well
                         if (out != null) {
@@ -804,15 +804,15 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
             // look it up again as the naming service does not do negative caching
             // so it will be slow.
             Destination clientDest = null;
-            String addressHelper = addressHelpers.get(destination.toLowerCase());
+            String addressHelper = addressHelpers.get(destination.toLowerCase(Locale.US));
             if (addressHelper != null) {
                 clientDest = _context.namingService().lookup(addressHelper);
                 // remove bad entries
                 if (clientDest == null)
-                    addressHelpers.remove(destination.toLowerCase());
+                    addressHelpers.remove(destination.toLowerCase(Locale.US));
             } else if ("i2p".equals(host)) {
                 clientDest = null;
-            } else if (destination.length() == 60 && destination.toLowerCase().endsWith(".b32.i2p")) {
+            } else if (destination.length() == 60 && destination.toLowerCase(Locale.US).endsWith(".b32.i2p")) {
                 // use existing session to look up for efficiency
                 verifySocketManager();
                 I2PSession sess = sockMgr.getSession();
@@ -841,7 +841,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
                     header = getErrorPage("dnfp", ERR_DESTINATION_UNKNOWN);
                 else if (ahelperPresent)
                     header = getErrorPage("dnfb", ERR_DESTINATION_UNKNOWN);
-                else if (destination.length() == 60 && destination.toLowerCase().endsWith(".b32.i2p"))
+                else if (destination.length() == 60 && destination.toLowerCase(Locale.US).endsWith(".b32.i2p"))
                     header = getErrorPage("dnf", ERR_DESTINATION_UNKNOWN);
                 else {
                     header = getErrorPage("dnfh", ERR_DESTINATION_UNKNOWN);
@@ -984,7 +984,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
      */
     private final String getHostName(String host) {
         if (host == null) return null;
-        if (host.length() == 60 && host.toLowerCase().endsWith(".b32.i2p"))
+        if (host.length() == 60 && host.toLowerCase(Locale.US).endsWith(".b32.i2p"))
             return host;
         Destination dest = _context.namingService().lookup(host);
         if (dest == null) return "i2p";
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/DCCClientManager.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/DCCClientManager.java
index d6a0f79587..decaa8bc1c 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/DCCClientManager.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/DCCClientManager.java
@@ -1,6 +1,7 @@
 package net.i2p.i2ptunnel.irc;
 
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -91,7 +92,7 @@ public class DCCClientManager extends EventReceiver {
      *  @param localPort bind to port or 0; if nonzero it will be the rv
      */
     private int newIncoming(String b32, int port, String type, int localPort) {
-        b32 = b32.toLowerCase();
+        b32 = b32.toLowerCase(Locale.US);
         // do some basic verification before starting the client
         if (b32.length() != 60 || !b32.endsWith(".b32.i2p"))
             return -1;
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/IRCFilter.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/IRCFilter.java
index 46c30746f6..f82b5b7538 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/IRCFilter.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/IRCFilter.java
@@ -2,6 +2,7 @@ package net.i2p.i2ptunnel.irc;
 
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.Locale;
 import java.util.Set;
 
 import net.i2p.data.DataHelper;
@@ -130,7 +131,7 @@ abstract class IRCFilter {
                 }
                 // XDCC looks safe, ip/port happens over regular DCC
                 // http://en.wikipedia.org/wiki/XDCC
-                if (msg.toUpperCase().startsWith("XDCC ") && helper != null && helper.isEnabled())
+                if (msg.toUpperCase(Locale.US).startsWith("XDCC ") && helper != null && helper.isEnabled())
                     return s;
                 if (ALLOW_ALL_CTCP_IN)
                     return s;
@@ -209,7 +210,7 @@ abstract class IRCFilter {
         if(field[0].charAt(0)==':')
             return null; // wtf
         
-        String command = field[0].toUpperCase();
+        String command = field[0].toUpperCase(Locale.US);
 
 	if ("PING".equals(command)) {
             // Most clients just send a PING and are happy with any old PONG.  Others,
@@ -292,7 +293,7 @@ abstract class IRCFilter {
                     return filterDCCOut(field[0] + ' ' + field[1] + " :\001DCC ", msg.substring(4), helper);
                 // XDCC looks safe, ip/port happens over regular DCC
                 // http://en.wikipedia.org/wiki/XDCC
-                if (msg.toUpperCase().startsWith("XDCC ") && helper != null && helper.isEnabled())
+                if (msg.toUpperCase(Locale.US).startsWith("XDCC ") && helper != null && helper.isEnabled())
                     return s;
                 if (ALLOW_ALL_CTCP_OUT)
                     return s;
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java
index 865d089bfe..fef68f1867 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java
@@ -14,6 +14,7 @@ import java.net.InetAddress;
 import java.net.Socket;
 import java.net.SocketException;
 import java.util.List;
+import java.util.Locale;
 
 import net.i2p.I2PAppContext;
 import net.i2p.I2PException;
@@ -198,8 +199,8 @@ public class SOCKS4aServer extends SOCKSServer {
         I2PSocket destSock;
 
         try {
-            if (connHostName.toLowerCase().endsWith(".i2p") ||
-                connHostName.toLowerCase().endsWith(".onion")) {
+            if (connHostName.toLowerCase(Locale.US).endsWith(".i2p") ||
+                connHostName.toLowerCase(Locale.US).endsWith(".onion")) {
                 _log.debug("connecting to " + connHostName + "...");
                 // Let's not due a new Dest for every request, huh?
                 //I2PSocketManager sm = I2PSocketManagerFactory.createManager();
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS5Server.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS5Server.java
index 4625b7cd8e..50b633c960 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS5Server.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS5Server.java
@@ -16,6 +16,7 @@ import java.net.SocketException;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Properties;
 
 import net.i2p.I2PAppContext;
@@ -355,7 +356,7 @@ public class SOCKS5Server extends SOCKSServer {
         I2PSocket destSock;
 
         try {
-            if (connHostName.toLowerCase().endsWith(".i2p")) {
+            if (connHostName.toLowerCase(Locale.US).endsWith(".i2p")) {
                 _log.debug("connecting to " + connHostName + "...");
                 // Let's not due a new Dest for every request, huh?
                 //I2PSocketManager sm = I2PSocketManagerFactory.createManager();
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java
index 94291ad5bf..3364b0a34a 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java
@@ -14,6 +14,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -185,10 +186,10 @@ public class IndexBean {
         else if ("start".equals(_action))
             return start();
         else if ("Save changes".equals(_action) || // IE workaround:
-                (_action.toLowerCase().indexOf("s</span>ave") >= 0))
+                (_action.toLowerCase(Locale.US).indexOf("s</span>ave") >= 0))
             return saveChanges();
         else if ("Delete this proxy".equals(_action) || // IE workaround:
-                (_action.toLowerCase().indexOf("d</span>elete") >= 0))
+                (_action.toLowerCase(Locale.US).indexOf("d</span>elete") >= 0))
             return deleteTunnel();
         else if ("Estimate".equals(_action))
             return PrivateKeyFile.estimateHashCashTime(_hashCashValue);
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java
index abf1c1c8b3..eb28a4b90e 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java
@@ -5,6 +5,7 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -131,8 +132,8 @@ public class ConfigClientsHandler extends FormHandler {
 
         // label (IE)
         String xStart = _("Start");
-        if (_action.toLowerCase().startsWith(xStart + "<span class=hide> ") &&
-                   _action.toLowerCase().endsWith("</span>")) {
+        if (_action.toLowerCase(Locale.US).startsWith(xStart + "<span class=hide> ") &&
+                   _action.toLowerCase(Locale.US).endsWith("</span>")) {
             // IE sucks
             String app = _action.substring(xStart.length() + 18, _action.length() - 7);
             int appnum = -1;
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/NetDbRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/NetDbRenderer.java
index e8e498da2e..7e44cd6e83 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/NetDbRenderer.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/NetDbRenderer.java
@@ -305,7 +305,7 @@ public class NetDbRenderer {
             buf.append("<tr><th align=\"left\">" + _("Country") + "</th><th>" + _("Count") + "</th></tr>\n");
             for (String country : countryList) {
                 int num = countries.count(country);
-                buf.append("<tr><td><img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase()).append("\"");
+                buf.append("<tr><td><img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase(Locale.US)).append("\"");
                 buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> ");
                 buf.append(_(_context.commSystem().getCountryName(country)));
                 buf.append("</td><td align=\"center\">").append(num).append("</td></tr>\n");
@@ -365,7 +365,7 @@ public class NetDbRenderer {
         buf.append("<b>" + _("Address(es)") + ":</b> ");
         String country = _context.commSystem().getCountry(info.getIdentity().getHash());
         if(country != null) {
-            buf.append("<img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase()).append('\"');
+            buf.append("<img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase(Locale.US)).append('\"');
             buf.append(" title=\"").append(_(_context.commSystem().getCountryName(country))).append('\"');
             buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> ");
         }
diff --git a/apps/susidns/src/java/src/i2p/susi/dns/AddressBean.java b/apps/susidns/src/java/src/i2p/susi/dns/AddressBean.java
index 71e95bf43e..6f34af3e5b 100644
--- a/apps/susidns/src/java/src/i2p/susi/dns/AddressBean.java
+++ b/apps/susidns/src/java/src/i2p/susi/dns/AddressBean.java
@@ -26,6 +26,7 @@ package i2p.susi.dns;
 
 import java.net.IDN;
 import java.util.Date;
+import java.util.Locale;
 import java.util.Properties;
 
 import net.i2p.I2PAppContext;
@@ -113,7 +114,7 @@ public class AddressBean
 	 * @since 0.8.7
 	 */
 	static String toASCII(String host) throws IllegalArgumentException {
-		host = host.toLowerCase();
+		host = host.toLowerCase(Locale.US);
 
 		boolean needsIDN = false;
 		// Here we do easy checks and throw translated exceptions.
diff --git a/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java b/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java
index 63255254dd..86aa56a38d 100644
--- a/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java
+++ b/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java
@@ -33,6 +33,7 @@ import java.util.Comparator;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.LinkedList;
+import java.util.Locale;
 import java.util.Properties;
 
 import net.i2p.data.DataFormatException;
@@ -191,7 +192,7 @@ public class AddressbookBean
 						if( first < '0' || first > '9' )
 							continue;
 					}
-					else if( ! name.toLowerCase().startsWith( filter.toLowerCase() ) ) {
+					else if( ! name.toLowerCase(Locale.US).startsWith( filter.toLowerCase(Locale.US) ) ) {
 						continue;
 					}
 				}
diff --git a/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java b/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java
index a06230bd41..d1ad65825f 100644
--- a/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java
+++ b/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java
@@ -27,6 +27,7 @@ import java.util.Comparator;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 
@@ -169,7 +170,7 @@ public class NamingServiceBean extends AddressbookBean
 					searchProps.setProperty("limit", Integer.toString(limit));
 			}
 			if (search != null && search.length() > 0)
-				searchProps.setProperty("search", search.toLowerCase());
+				searchProps.setProperty("search", search.toLowerCase(Locale.US));
 			results = service.getEntries(searchProps);
 
 			Debug.debug("Result count: " + results.size());
@@ -181,7 +182,7 @@ public class NamingServiceBean extends AddressbookBean
 						if( first < '0' || first > '9' )
 							continue;
 					}
-					else if( ! name.toLowerCase().startsWith( filter.toLowerCase() ) ) {
+					else if( ! name.toLowerCase(Locale.US).startsWith( filter.toLowerCase(Locale.US) ) ) {
 						continue;
 					}
 				}
diff --git a/apps/susimail/src/src/i2p/susi/webmail/Mail.java b/apps/susimail/src/src/i2p/susi/webmail/Mail.java
index 98cf7c9e59..06e390a806 100644
--- a/apps/susimail/src/src/i2p/susi/webmail/Mail.java
+++ b/apps/susimail/src/src/i2p/susi/webmail/Mail.java
@@ -213,7 +213,7 @@ public class Mail {
 								shortSubject = formattedSubject.substring( 0, 57 ).trim() + "...";
 							shortSubject = html.encode( shortSubject );
 						}
-						else if( line.toLowerCase().startsWith( "Reply-To:" ) ) {
+						else if( line.toLowerCase(Locale.US).startsWith( "reply-to:" ) ) {
 							reply = Mail.getAddress( line.substring( 9 ).trim() );
 						}
 						else if( line.startsWith( "To:" ) ) {
diff --git a/apps/susimail/src/src/i2p/susi/webmail/MailPart.java b/apps/susimail/src/src/i2p/susi/webmail/MailPart.java
index 0986c80e7c..4207b8a5e6 100644
--- a/apps/susimail/src/src/i2p/susi/webmail/MailPart.java
+++ b/apps/susimail/src/src/i2p/susi/webmail/MailPart.java
@@ -27,6 +27,7 @@ import i2p.susi.util.ReadBuffer;
 import i2p.susi.webmail.encoding.EncodingFactory;
 
 import java.util.ArrayList;
+import java.util.Locale;
 
 /**
  * @author susi23
@@ -82,18 +83,18 @@ public class MailPart {
 
 		for( int i = 0; i < headerLines.length; i++ )
 		{
-			if( headerLines[i].toLowerCase().startsWith( "content-transfer-encoding: " ) ) {
-				encoding = getFirstAttribute( headerLines[i] ).toLowerCase();
+			if( headerLines[i].toLowerCase(Locale.US).startsWith( "content-transfer-encoding: " ) ) {
+				encoding = getFirstAttribute( headerLines[i] ).toLowerCase(Locale.US);
 			}
-			else if( headerLines[i].toLowerCase().startsWith( "content-disposition: " ) ) {
-				disposition = getFirstAttribute( headerLines[i] ).toLowerCase();
+			else if( headerLines[i].toLowerCase(Locale.US).startsWith( "content-disposition: " ) ) {
+				disposition = getFirstAttribute( headerLines[i] ).toLowerCase(Locale.US);
 				String str;
 				str = getHeaderLineAttribute( headerLines[i], "filename" );
 				if( str != null )
 					name = str;
 			}
-			else if( headerLines[i].toLowerCase().startsWith( "content-type: " ) ) {
-				type = getFirstAttribute( headerLines[i] ).toLowerCase();
+			else if( headerLines[i].toLowerCase(Locale.US).startsWith( "content-type: " ) ) {
+				type = getFirstAttribute( headerLines[i] ).toLowerCase(Locale.US);
 				/*
 				 * extract boundary, name and charset from content type
 				 */
@@ -110,12 +111,12 @@ public class MailPart {
 					name = str;
 				str = getHeaderLineAttribute( headerLines[i], "charset" );
 				if( str != null )
-					charset = str.toUpperCase();
+					charset = str.toUpperCase(Locale.US);
 			}
-			else if( headerLines[i].toLowerCase().startsWith( "content-description: " ) ) {
+			else if( headerLines[i].toLowerCase(Locale.US).startsWith( "content-description: " ) ) {
 				description = getFirstAttribute( headerLines[i] );
 			}
-			else if( headerLines[i].toLowerCase().startsWith( "mime-version: " ) ) {
+			else if( headerLines[i].toLowerCase(Locale.US).startsWith( "mime-version: " ) ) {
 				version = getFirstAttribute( headerLines[i] );
 			}
 		}
diff --git a/apps/susimail/src/src/i2p/susi/webmail/RequestWrapper.java b/apps/susimail/src/src/i2p/susi/webmail/RequestWrapper.java
index 0c1d835cc1..98350708ca 100644
--- a/apps/susimail/src/src/i2p/susi/webmail/RequestWrapper.java
+++ b/apps/susimail/src/src/i2p/susi/webmail/RequestWrapper.java
@@ -27,6 +27,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.Locale;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
@@ -55,7 +56,7 @@ public class RequestWrapper {
 		cache = new Hashtable();
 		this.httpRequest = httpRequest;
 		String contentType = httpRequest.getContentType();
-		if( contentType != null && contentType.toLowerCase().startsWith( "multipart/form-data" ) ) {
+		if( contentType != null && contentType.toLowerCase(Locale.US).startsWith( "multipart/form-data" ) ) {
 			try {
 				multiPartRequest = new MultiPartRequest( httpRequest );
 			} catch (IOException e) {
@@ -122,7 +123,7 @@ public class RequestWrapper {
 			Hashtable params = multiPartRequest.getParams( partName );
 			for( Enumeration e = params.keys(); e.hasMoreElements(); ) {
 				String key = (String)e.nextElement();
-				if( key.toLowerCase().compareToIgnoreCase( "content-type") == 0 ) {
+				if( key.toLowerCase(Locale.US).compareToIgnoreCase( "content-type") == 0 ) {
 					String value = (String)params.get( key );
 					int i = value.indexOf( ";" );
 					if( i != -1 )
diff --git a/apps/susimail/src/src/i2p/susi/webmail/WebMail.java b/apps/susimail/src/src/i2p/susi/webmail/WebMail.java
index 8668207be4..4192154453 100644
--- a/apps/susimail/src/src/i2p/susi/webmail/WebMail.java
+++ b/apps/susimail/src/src/i2p/susi/webmail/WebMail.java
@@ -48,6 +48,7 @@ import java.util.Comparator;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.ListIterator;
+import java.util.Locale;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
@@ -940,7 +941,7 @@ public class WebMail extends HttpServlet
 						String contentType = request.getContentType( NEW_FILENAME );
 						Encoding encoding;
 						String encodeTo;
-						if( contentType.toLowerCase().startsWith( "text/" ) )
+						if( contentType.toLowerCase(Locale.US).startsWith( "text/" ) )
 							encodeTo = "quoted-printable";
 						else
 							encodeTo = "base64";
diff --git a/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java b/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java
index 67643b6776..f32492a389 100644
--- a/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java
+++ b/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java
@@ -19,6 +19,7 @@ import java.net.MalformedURLException;
 import java.net.Socket;
 import java.net.SocketAddress;
 import java.net.URL;
+import java.util.Locale;
 
 import net.i2p.I2PAppContext;
 import net.i2p.util.ShellCommand;
@@ -105,8 +106,8 @@ public class UrlLauncher {
 
         waitForServer(url);
         if (validateUrlFormat(url)) {
-            if (osName.toLowerCase().indexOf("mac") > -1) {
-                if (osName.toLowerCase().startsWith("mac os x")) {
+            if (osName.toLowerCase(Locale.US).indexOf("mac") > -1) {
+                if (osName.toLowerCase(Locale.US).startsWith("mac os x")) {
 
                     if (_shellCommand.executeSilentAndWaitTimed("safari " + url, 5))
                         return true;
@@ -131,7 +132,7 @@ public class UrlLauncher {
                     for (String line; (line = bufferedReader.readLine()) != null; ) {
                         if (line.startsWith("@=")) {
                             // we should really use the whole line and replace %1 with the url
-                            browserString = line.substring(3, line.toLowerCase().indexOf(".exe") + 4);
+                            browserString = line.substring(3, line.toLowerCase(Locale.US).indexOf(".exe") + 4);
                             if (browserString.startsWith("\\\""))
                                 browserString = browserString.substring(2);
                             browserString = "\"" + browserString + "\"";
diff --git a/core/java/src/freenet/support/CPUInformation/CPUID.java b/core/java/src/freenet/support/CPUInformation/CPUID.java
index 7bb8ef0a39..197937496b 100644
--- a/core/java/src/freenet/support/CPUInformation/CPUID.java
+++ b/core/java/src/freenet/support/CPUInformation/CPUID.java
@@ -10,6 +10,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.HashMap;
+import java.util.Locale;
 
 import net.i2p.I2PAppContext;
 import net.i2p.util.FileUtil;
@@ -51,12 +52,12 @@ public class CPUID {
                                          System.getProperty("os.arch").equals("amd64");
     private static final String libPrefix = (System.getProperty("os.name").startsWith("Win") ? "" : "lib");
     private static final String libSuffix = (System.getProperty("os.name").startsWith("Win") ? ".dll" : ".so");
-    private static final boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
-    private static final boolean isLinux = System.getProperty("os.name").toLowerCase().contains("linux");
-    private static final boolean isFreebsd = System.getProperty("os.name").toLowerCase().contains("freebsd");
-    private static final boolean isNetbsd = System.getProperty("os.name").toLowerCase().contains("netbsd");
-    private static final boolean isOpenbsd = System.getProperty("os.name").toLowerCase().contains("openbsd");
-    private static final boolean isSunos = System.getProperty("os.name").toLowerCase().contains("sunos");
+    private static final boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.US).contains("windows");
+    private static final boolean isLinux = System.getProperty("os.name").toLowerCase(Locale.US).contains("linux");
+    private static final boolean isFreebsd = System.getProperty("os.name").toLowerCase(Locale.US).contains("freebsd");
+    private static final boolean isNetbsd = System.getProperty("os.name").toLowerCase(Locale.US).contains("netbsd");
+    private static final boolean isOpenbsd = System.getProperty("os.name").toLowerCase(Locale.US).contains("openbsd");
+    private static final boolean isSunos = System.getProperty("os.name").toLowerCase(Locale.US).contains("sunos");
     private static final boolean isMac = System.getProperty("os.name").startsWith("Mac");
 
 
diff --git a/core/java/src/net/i2p/client/I2CPSSLSocketFactory.java b/core/java/src/net/i2p/client/I2CPSSLSocketFactory.java
index d562388f13..70c8461d7e 100644
--- a/core/java/src/net/i2p/client/I2CPSSLSocketFactory.java
+++ b/core/java/src/net/i2p/client/I2CPSSLSocketFactory.java
@@ -13,6 +13,7 @@ import java.security.cert.CertificateExpiredException;
 import java.security.cert.CertificateNotYetValidException;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
+import java.util.Locale;
 
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocketFactory;
@@ -129,7 +130,7 @@ class I2CPSSLSocketFactory {
                     if (!f.isFile())
                         continue;
                     // use file name as alias
-                    String alias = f.getName().toLowerCase();
+                    String alias = f.getName().toLowerCase(Locale.US);
                     boolean success = addCert(f, alias, ks);
                     if (success)
                         added++;
diff --git a/core/java/src/net/i2p/client/naming/BlockfileNamingService.java b/core/java/src/net/i2p/client/naming/BlockfileNamingService.java
index 7c07aa903b..6d0e1bb6f3 100644
--- a/core/java/src/net/i2p/client/naming/BlockfileNamingService.java
+++ b/core/java/src/net/i2p/client/naming/BlockfileNamingService.java
@@ -21,6 +21,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.StringTokenizer;
@@ -229,7 +230,7 @@ public class BlockfileNamingService extends DummyNamingService {
                         int split = line.indexOf('=');
                         if (split <= 0)
                             continue;
-                        String key = line.substring(0, split).toLowerCase();
+                        String key = line.substring(0, split).toLowerCase(Locale.US);
                         if (line.indexOf('#') > 0)  { // trim off any end of line comment
                             line = line.substring(0, line.indexOf('#')).trim();
                             if (line.length() < split + 1)
@@ -622,11 +623,11 @@ public class BlockfileNamingService extends DummyNamingService {
             if (d != null)
                 return d;
             // Base32 failed?
-            if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase().endsWith(".b32.i2p"))
+            if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase(Locale.US).endsWith(".b32.i2p"))
                 return null;
         }
 
-        String key = hostname.toLowerCase();
+        String key = hostname.toLowerCase(Locale.US);
         synchronized(_bf) {
             if (_isClosed)
                 return null;
@@ -681,7 +682,7 @@ public class BlockfileNamingService extends DummyNamingService {
             _log.error("Add entry failed, read-only hosts database");
             return false;
         }
-        String key = hostname.toLowerCase();
+        String key = hostname.toLowerCase(Locale.US);
         String listname = FALLBACK_LIST;
         Properties props = new Properties();
         props.setProperty(PROP_ADDED, Long.toString(_context.clock().now()));
@@ -735,7 +736,7 @@ public class BlockfileNamingService extends DummyNamingService {
             _log.error("Remove entry failed, read-only hosts database");
             return false;
         }
-        String key = hostname.toLowerCase();
+        String key = hostname.toLowerCase(Locale.US);
         String listname = FALLBACK_LIST;
         if (options != null) {
             String list = options.getProperty("list");
diff --git a/core/java/src/net/i2p/client/naming/DummyNamingService.java b/core/java/src/net/i2p/client/naming/DummyNamingService.java
index 228276da84..21f8a7c7cc 100644
--- a/core/java/src/net/i2p/client/naming/DummyNamingService.java
+++ b/core/java/src/net/i2p/client/naming/DummyNamingService.java
@@ -8,6 +8,7 @@
 package net.i2p.client.naming;
 
 import java.util.LinkedHashMap;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 
@@ -64,7 +65,7 @@ class DummyNamingService extends NamingService {
         }
 
         // Try Base32 decoding
-        if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase().endsWith(".b32.i2p") &&
+        if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase(Locale.US).endsWith(".b32.i2p") &&
             _context.getBooleanPropertyDefaultTrue(PROP_B32)) {
             d = LookupDest.lookupBase32Hash(_context, hostname.substring(0, BASE32_HASH_LENGTH));
             if (d != null) {
diff --git a/core/java/src/net/i2p/client/naming/EepGetAndAddNamingService.java b/core/java/src/net/i2p/client/naming/EepGetAndAddNamingService.java
index 83baf8a43e..d7ab373560 100644
--- a/core/java/src/net/i2p/client/naming/EepGetAndAddNamingService.java
+++ b/core/java/src/net/i2p/client/naming/EepGetAndAddNamingService.java
@@ -7,6 +7,7 @@ package net.i2p.client.naming;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.Locale;
 
 import net.i2p.I2PAppContext;
 import net.i2p.data.Destination;
@@ -46,7 +47,7 @@ public class EepGetAndAddNamingService extends EepGetNamingService {
     public Destination lookup(String hostname) {
         Destination rv = super.lookup(hostname);
         if (rv != null) {
-            hostname = hostname.toLowerCase();
+            hostname = hostname.toLowerCase(Locale.US);
             // If it's long, assume it's a key.
             if (hostname.length() < 516 && hostname.endsWith(".i2p") && ! hostname.endsWith(".b32.i2p")) {
                 File f = new File(_context.getRouterDir(), DEFAULT_HOSTS_FILE);
diff --git a/core/java/src/net/i2p/client/naming/EepGetNamingService.java b/core/java/src/net/i2p/client/naming/EepGetNamingService.java
index cd63bcc62a..24d39942d5 100644
--- a/core/java/src/net/i2p/client/naming/EepGetNamingService.java
+++ b/core/java/src/net/i2p/client/naming/EepGetNamingService.java
@@ -7,6 +7,7 @@ package net.i2p.client.naming;
 import java.io.ByteArrayOutputStream;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
@@ -65,7 +66,7 @@ public class EepGetNamingService extends DummyNamingService {
         if (d != null)
             return d;
 
-        hostname = hostname.toLowerCase();
+        hostname = hostname.toLowerCase(Locale.US);
         // Base32 failed?
         if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.endsWith(".b32.i2p"))
             return null;
diff --git a/core/java/src/net/i2p/client/naming/ExecNamingService.java b/core/java/src/net/i2p/client/naming/ExecNamingService.java
index 40383ca789..221b95c5a1 100644
--- a/core/java/src/net/i2p/client/naming/ExecNamingService.java
+++ b/core/java/src/net/i2p/client/naming/ExecNamingService.java
@@ -5,6 +5,7 @@
 package net.i2p.client.naming;
 
 import java.io.InputStream;
+import java.util.Locale;
 import java.util.Properties;
 
 import net.i2p.I2PAppContext;
@@ -65,10 +66,10 @@ public class ExecNamingService extends DummyNamingService {
         if (d != null)
             return d;
         // Base32 failed?
-        if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase().endsWith(".b32.i2p"))
+        if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase(Locale.US).endsWith(".b32.i2p"))
             return null;
 
-        hostname = hostname.toLowerCase();
+        hostname = hostname.toLowerCase(Locale.US);
 
         // lookup
         String key = fetchAddr(hostname);	  	
diff --git a/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java b/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java
index b40e4d663c..baa371e766 100644
--- a/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java
+++ b/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java
@@ -10,6 +10,7 @@ package net.i2p.client.naming;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
@@ -62,22 +63,22 @@ public class HostsTxtNamingService extends MetaNamingService {
         // If it's long, assume it's a key.
         if (hostname.length() >= DEST_SIZE)
             return lookupBase64(hostname);
-        return super.lookup(hostname.toLowerCase(), lookupOptions, storedOptions);
+        return super.lookup(hostname.toLowerCase(Locale.US), lookupOptions, storedOptions);
     }
 
     @Override
     public boolean put(String hostname, Destination d, Properties options) {
-        return super.put(hostname.toLowerCase(), d, options);
+        return super.put(hostname.toLowerCase(Locale.US), d, options);
     }
 
     @Override
     public boolean putIfAbsent(String hostname, Destination d, Properties options) {
-        return super.putIfAbsent(hostname.toLowerCase(), d, options);
+        return super.putIfAbsent(hostname.toLowerCase(Locale.US), d, options);
     }
 
     @Override
     public boolean remove(String hostname, Properties options) {
-        return super.remove(hostname.toLowerCase(), options);
+        return super.remove(hostname.toLowerCase(Locale.US), options);
     }
 
     /**
diff --git a/core/java/src/net/i2p/client/naming/MetaNamingService.java b/core/java/src/net/i2p/client/naming/MetaNamingService.java
index 215aa11c0b..0ff543297b 100644
--- a/core/java/src/net/i2p/client/naming/MetaNamingService.java
+++ b/core/java/src/net/i2p/client/naming/MetaNamingService.java
@@ -6,6 +6,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -101,7 +102,7 @@ public class MetaNamingService extends DummyNamingService {
         if (d != null)
             return d;
         // Base32 failed?
-        if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase().endsWith(".b32.i2p"))
+        if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase(Locale.US).endsWith(".b32.i2p"))
             return null;
 
         for (NamingService ns : _services) { 
diff --git a/core/java/src/net/i2p/data/DataHelper.java b/core/java/src/net/i2p/data/DataHelper.java
index 1b147ee29c..0202fcf608 100644
--- a/core/java/src/net/i2p/data/DataHelper.java
+++ b/core/java/src/net/i2p/data/DataHelper.java
@@ -36,6 +36,7 @@ import java.util.Comparator;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.TreeMap;
@@ -371,7 +372,7 @@ public class DataHelper {
                 //val = val.replaceAll("\\\\n","\n");
                 if ( (key.length() > 0) && (val.length() > 0) )
                     if (forceLowerCase)
-                        props.setProperty(key.toLowerCase(), val);
+                        props.setProperty(key.toLowerCase(Locale.US), val);
                     else
                         props.setProperty(key, val);
             }
diff --git a/core/java/src/net/i2p/time/Timestamper.java b/core/java/src/net/i2p/time/Timestamper.java
index addec7f74f..8bdb3101be 100644
--- a/core/java/src/net/i2p/time/Timestamper.java
+++ b/core/java/src/net/i2p/time/Timestamper.java
@@ -290,7 +290,7 @@ public class Timestamper implements Runnable {
             if (country == null) {
                 country = Locale.getDefault().getCountry();
                 if (country != null)
-                    country = country.toLowerCase();
+                    country = country.toLowerCase(Locale.US);
             }
             if (country != null &&  country.length() > 0) {
                 _priorityServers = new ArrayList(3);
diff --git a/core/java/src/net/i2p/util/ConvertToHash.java b/core/java/src/net/i2p/util/ConvertToHash.java
index 28da87d217..182ae7cfaa 100644
--- a/core/java/src/net/i2p/util/ConvertToHash.java
+++ b/core/java/src/net/i2p/util/ConvertToHash.java
@@ -1,5 +1,7 @@
 package net.i2p.util;
 
+import java.util.Locale;
+
 import net.i2p.I2PAppContext;
 import net.i2p.data.Base32;
 import net.i2p.data.DataFormatException;
@@ -29,7 +31,7 @@ public class ConvertToHash {
         if (peer == null)
             return null;
         Hash h = new Hash();
-        String peerLC = peer.toLowerCase();
+        String peerLC = peer.toLowerCase(Locale.US);
         // b64 hash
         if (peer.length() == 44 && !peerLC.endsWith(".i2p")) {
             try {
diff --git a/core/java/src/net/i2p/util/EepGet.java b/core/java/src/net/i2p/util/EepGet.java
index 7a59775d19..52121e8e1a 100644
--- a/core/java/src/net/i2p/util/EepGet.java
+++ b/core/java/src/net/i2p/util/EepGet.java
@@ -15,6 +15,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.Formatter;
 import java.util.List;
+import java.util.Locale;
 import java.util.StringTokenizer;
 
 import net.i2p.I2PAppContext;
@@ -949,13 +950,13 @@ public class EepGet {
         } else if (key.equalsIgnoreCase("Last-Modified")) {
             _lastModified = val;
         } else if (key.equalsIgnoreCase("Transfer-encoding")) {
-            _encodingChunked = val.toLowerCase().contains("chunked");
+            _encodingChunked = val.toLowerCase(Locale.US).contains("chunked");
         } else if (key.equalsIgnoreCase("Content-encoding")) {
             // This is kindof a hack, but if we are downloading a gzip file
             // we don't want to transparently gunzip it and save it as a .gz file.
             // A query string will also mess this up
             if ((!_actualURL.endsWith(".gz")) && (!_actualURL.endsWith(".tgz")))
-                _isGzippedResponse = val.toLowerCase().contains("gzip");
+                _isGzippedResponse = val.toLowerCase(Locale.US).contains("gzip");
         } else if (key.equalsIgnoreCase("Content-Type")) {
             _contentType=val;
         } else if (key.equalsIgnoreCase("Location")) {
diff --git a/core/java/src/net/i2p/util/Log.java b/core/java/src/net/i2p/util/Log.java
index 753f762d4a..0a03e19b5e 100644
--- a/core/java/src/net/i2p/util/Log.java
+++ b/core/java/src/net/i2p/util/Log.java
@@ -9,6 +9,8 @@ package net.i2p.util;
  *
  */
 
+import java.util.Locale;
+
 import net.i2p.I2PAppContext;
 
 /**
@@ -44,7 +46,7 @@ public class Log {
 
     public static int getLevel(String level) {
         if (level == null) return Log.CRIT;
-        level = level.toUpperCase();
+        level = level.toUpperCase(Locale.US);
         if (STR_DEBUG.startsWith(level)) return DEBUG;
         if (STR_INFO.startsWith(level)) return INFO;
         if (STR_WARN.startsWith(level)) return WARN;
diff --git a/core/java/src/net/i2p/util/LogManager.java b/core/java/src/net/i2p/util/LogManager.java
index dbdbea8efb..3f41b0816a 100644
--- a/core/java/src/net/i2p/util/LogManager.java
+++ b/core/java/src/net/i2p/util/LogManager.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Properties;
 import java.util.Queue;
 import java.util.Set;
@@ -312,9 +313,9 @@ public class LogManager {
         if (disp == null)
             _displayOnScreen = DEFAULT_DISPLAYONSCREEN;
         else {
-            if ("TRUE".equals(disp.toUpperCase().trim()))
+            if ("TRUE".equals(disp.toUpperCase(Locale.US).trim()))
                 _displayOnScreen = true;
-            else if ("YES".equals(disp.toUpperCase().trim()))
+            else if ("YES".equals(disp.toUpperCase(Locale.US).trim()))
                 _displayOnScreen = true;
             else
                 _displayOnScreen = false;
@@ -463,7 +464,7 @@ public class LogManager {
      */
     public static int getFileSize(String size) {
         try {
-            String v = size.trim().toUpperCase();
+            String v = size.trim().toUpperCase(Locale.US);
             if (v.length() < 2)
                 return -1;
             if (v.endsWith("B"))
diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java
index 1f0ecc770f..74dd5b1d01 100644
--- a/core/java/src/net/i2p/util/NativeBigInteger.java
+++ b/core/java/src/net/i2p/util/NativeBigInteger.java
@@ -19,6 +19,7 @@ import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Locale;
 import java.util.Random;
 
 import freenet.support.CPUInformation.AMDCPUInfo;
@@ -155,11 +156,11 @@ public class NativeBigInteger extends BigInteger {
     private static final boolean _isWin = System.getProperty("os.name").startsWith("Win");
     private static final boolean _isOS2 = System.getProperty("os.name").startsWith("OS/2");
     private static final boolean _isMac = System.getProperty("os.name").startsWith("Mac");
-    private static final boolean _isLinux = System.getProperty("os.name").toLowerCase().contains("linux");
-    private static final boolean _isFreebsd = System.getProperty("os.name").toLowerCase().contains("freebsd");
-    private static final boolean _isNetbsd = System.getProperty("os.name").toLowerCase().contains("netbsd");
-    private static final boolean _isOpenbsd = System.getProperty("os.name").toLowerCase().contains("openbsd");
-    private static final boolean _isSunos = System.getProperty("os.name").toLowerCase().contains("sunos");
+    private static final boolean _isLinux = System.getProperty("os.name").toLowerCase(Locale.US).contains("linux");
+    private static final boolean _isFreebsd = System.getProperty("os.name").toLowerCase(Locale.US).contains("freebsd");
+    private static final boolean _isNetbsd = System.getProperty("os.name").toLowerCase(Locale.US).contains("netbsd");
+    private static final boolean _isOpenbsd = System.getProperty("os.name").toLowerCase(Locale.US).contains("openbsd");
+    private static final boolean _isSunos = System.getProperty("os.name").toLowerCase(Locale.US).contains("sunos");
     private static final boolean _isAndroid = System.getProperty("java.vendor").contains("Android");
 
     /*
diff --git a/core/java/src/net/i2p/util/SSLEepGet.java b/core/java/src/net/i2p/util/SSLEepGet.java
index e108c7157e..31425a381b 100644
--- a/core/java/src/net/i2p/util/SSLEepGet.java
+++ b/core/java/src/net/i2p/util/SSLEepGet.java
@@ -58,6 +58,7 @@ import java.security.cert.CertificateNotYetValidException;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
 import java.util.Enumeration;
+import java.util.Locale;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLHandshakeException;
 import javax.net.ssl.SSLSocketFactory;
@@ -302,7 +303,7 @@ public class SSLEepGet extends EepGet {
                     // use file name as alias
                     // https://www.sslshopper.com/ssl-converter.html
                     // No idea if all these formats can actually be read by CertificateFactory
-                    String alias = f.getName().toLowerCase();
+                    String alias = f.getName().toLowerCase(Locale.US);
                     if (alias.endsWith(".crt") || alias.endsWith(".pem") || alias.endsWith(".key") ||
                         alias.endsWith(".der") || alias.endsWith(".key") || alias.endsWith(".p7b") ||
                         alias.endsWith(".p7c") || alias.endsWith(".pfx") || alias.endsWith(".p12"))
diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java
index e38b191f15..66de4c743e 100644
--- a/router/java/src/net/i2p/router/Router.java
+++ b/router/java/src/net/i2p/router/Router.java
@@ -23,6 +23,7 @@ import java.util.GregorianCalendar;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -1468,7 +1469,7 @@ public class Router implements RouterClock.ClockShiftListener {
     private void deleteJbigiFiles() {
             String osArch = System.getProperty("os.arch");
             boolean isX86 = osArch.contains("86") || osArch.equals("amd64");
-            String osName = System.getProperty("os.name").toLowerCase();
+            String osName = System.getProperty("os.name").toLowerCase(Locale.US);
             boolean isWin = osName.startsWith("win");
             boolean isMac = osName.startsWith("mac");
             // only do this on these OSes
diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java b/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java
index 5941919144..a0bb3be85b 100644
--- a/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java
+++ b/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java
@@ -14,6 +14,7 @@ import java.io.FileOutputStream;
 import java.io.FilenameFilter;
 import java.io.IOException;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.concurrent.ConcurrentHashMap;
@@ -522,8 +523,8 @@ class PersistentDataStore extends TransientDataStore {
         public static final FilenameFilter getInstance() { return _instance; }
         public boolean accept(File dir, String name) {
             if (name == null) return false;
-            name = name.toUpperCase();
-            return (name.startsWith(ROUTERINFO_PREFIX.toUpperCase()) && name.endsWith(ROUTERINFO_SUFFIX.toUpperCase()));
+            name = name.toUpperCase(Locale.US);
+            return (name.startsWith(ROUTERINFO_PREFIX.toUpperCase(Locale.US)) && name.endsWith(ROUTERINFO_SUFFIX.toUpperCase(Locale.US)));
         }
     }
 }
diff --git a/router/java/src/net/i2p/router/peermanager/DBHistory.java b/router/java/src/net/i2p/router/peermanager/DBHistory.java
index 3c5eb077ef..04db92ce69 100644
--- a/router/java/src/net/i2p/router/peermanager/DBHistory.java
+++ b/router/java/src/net/i2p/router/peermanager/DBHistory.java
@@ -2,6 +2,7 @@ package net.i2p.router.peermanager;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Locale;
 import java.util.Properties;
 
 import net.i2p.router.RouterContext;
@@ -233,7 +234,7 @@ public class DBHistory {
     }
     
     private static void add(StringBuilder buf, String name, long val, String description) {
-        buf.append("# ").append(name.toUpperCase()).append(NL).append("# ").append(description).append(NL);
+        buf.append("# ").append(name.toUpperCase(Locale.US)).append(NL).append("# ").append(description).append(NL);
         buf.append("dbHistory.").append(name).append('=').append(val).append(NL).append(NL);
     }
     
diff --git a/router/java/src/net/i2p/router/peermanager/PeerManager.java b/router/java/src/net/i2p/router/peermanager/PeerManager.java
index 9706047258..18619c62ea 100644
--- a/router/java/src/net/i2p/router/peermanager/PeerManager.java
+++ b/router/java/src/net/i2p/router/peermanager/PeerManager.java
@@ -15,6 +15,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -229,7 +230,7 @@ class PeerManager {
     public void setCapabilities(Hash peer, String caps) { 
         if (_log.shouldLog(Log.DEBUG))
             _log.debug("Setting capabilities for " + peer.toBase64() + " to " + caps);
-        caps = caps.toLowerCase();
+        caps = caps.toLowerCase(Locale.US);
 
         String oldCaps = _capabilitiesByPeer.put(peer, caps);
         if (caps.equals(oldCaps))
diff --git a/router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java b/router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java
index 2f6a478cd1..ce51a6134c 100644
--- a/router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java
+++ b/router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java
@@ -15,6 +15,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -511,7 +512,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
             String countryName = getCountryName(c);
             if (countryName.length() > 2)
                 countryName = Translate.getString(countryName, _context, BUNDLE_NAME);
-            buf.append("<img height=\"11\" width=\"16\" alt=\"").append(c.toUpperCase()).append("\" title=\"");
+            buf.append("<img height=\"11\" width=\"16\" alt=\"").append(c.toUpperCase(Locale.US)).append("\" title=\"");
             buf.append(countryName);
             buf.append("\" src=\"/flags.jsp?c=").append(c).append("\"> ");
         }
diff --git a/router/java/src/net/i2p/router/transport/GeoIP.java b/router/java/src/net/i2p/router/transport/GeoIP.java
index 96dc288770..7a9546bb44 100644
--- a/router/java/src/net/i2p/router/transport/GeoIP.java
+++ b/router/java/src/net/i2p/router/transport/GeoIP.java
@@ -12,6 +12,7 @@ import java.net.InetAddress;
 import java.io.InputStreamReader;
 import java.net.UnknownHostException;
 import java.util.Arrays;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -163,7 +164,7 @@ class GeoIP {
                         continue;
                     }
                     String[] s = line.split(",");
-                    String lc = s[0].toLowerCase();
+                    String lc = s[0].toLowerCase(Locale.US);
                     _codeToName.put(lc, s[1]);
                     _codeCache.put(lc, lc);
                 } catch (IndexOutOfBoundsException ioobe) {
@@ -231,7 +232,7 @@ class GeoIP {
                         idx++;
                     }
                     while (idx < search.length && search[idx].longValue() >= ip1 && search[idx].longValue() <= ip2) {
-                        String lc = s[2].toLowerCase();
+                        String lc = s[2].toLowerCase(Locale.US);
                         // replace the new string with the identical one from the cache
                         String cached = _codeCache.get(lc);
                         if (cached == null)
diff --git a/router/java/src/net/i2p/router/transport/TransportImpl.java b/router/java/src/net/i2p/router/transport/TransportImpl.java
index 1ee7a2573c..eb07c56038 100644
--- a/router/java/src/net/i2p/router/transport/TransportImpl.java
+++ b/router/java/src/net/i2p/router/transport/TransportImpl.java
@@ -16,6 +16,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
@@ -106,7 +107,7 @@ public abstract class TransportImpl implements Transport {
         if (style.equals("SSU"))
             style = "udp";
         else
-            style = style.toLowerCase();
+            style = style.toLowerCase(Locale.US);
         int def = DEFAULT_MAX_CONNECTIONS;
         RouterInfo ri = _context.router().getRouterInfo();
         if (ri != null) {
diff --git a/router/java/src/org/cybergarage/http/HTTPHeader.java b/router/java/src/org/cybergarage/http/HTTPHeader.java
index 9ea1610e9d..129ec7226b 100644
--- a/router/java/src/org/cybergarage/http/HTTPHeader.java
+++ b/router/java/src/org/cybergarage/http/HTTPHeader.java
@@ -19,6 +19,7 @@
 package org.cybergarage.http;
 
 import java.io.*;
+import java.util.Locale;
 
 import org.cybergarage.util.*;
 
@@ -85,7 +86,7 @@ public class HTTPHeader
 	
 	public final static String getValue(LineNumberReader reader, String name)
 	{
-		String bigName = name.toUpperCase();
+		String bigName = name.toUpperCase(Locale.US);
 		try {
 			String lineStr = reader.readLine();
 			while (lineStr != null && 0 < lineStr.length()) {
@@ -94,7 +95,7 @@ public class HTTPHeader
 					 lineStr = reader.readLine();
 					continue;
 				}
-				String bigLineHeaderName = header.getName().toUpperCase();
+				String bigLineHeaderName = header.getName().toUpperCase(Locale.US);
 				// Thanks for Jan Newmarch <jan.newmarch@infotech.monash.edu.au> (05/26/04)
 				if (bigLineHeaderName.equals(bigName) == false) {
 					 lineStr = reader.readLine();
diff --git a/router/java/src/org/cybergarage/util/FileUtil.java b/router/java/src/org/cybergarage/util/FileUtil.java
index 5e9b54a0dd..bd287ddcc9 100644
--- a/router/java/src/org/cybergarage/util/FileUtil.java
+++ b/router/java/src/org/cybergarage/util/FileUtil.java
@@ -3,7 +3,7 @@
 *	CyberUtil for Java
 *
 *	Copyright (C) Satoshi Konno 2002-2003
-*
+*
 *	File: FileUtil.java
 *
 *	Revision:
@@ -12,11 +12,12 @@
 *		- first revision.
 *
 ******************************************************************/
-
+
 package org.cybergarage.util;
 
 import java.io.*;
-
+import java.util.Locale;
+
 public final class FileUtil
 {
 	public final static byte[] load(String fileName)
@@ -70,7 +71,7 @@ public final class FileUtil
 	{
 		if (StringUtil.hasData(name) == false)
 			return false;
-		String lowerName = name.toLowerCase();
+		String lowerName = name.toLowerCase(Locale.US);
 		return lowerName.endsWith("xml");
 	}
 }
-- 
GitLab