diff --git a/apps/BOB/src/net/i2p/BOB/DoCMDS.java b/apps/BOB/src/net/i2p/BOB/DoCMDS.java index e070826d05b739ecc3eefdaf8fccba46062c7132..fd53efd6952ddeea37fa4cb345ce1f955eea64e1 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 0e00f1c50e421dbe3ddd2686f8985a680117dec1..42fe599e8b1af822881d3320b5576229b44a0e7c 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 961c57409bbc5d681a9b5cdb53843cc1a90e57b6..044f41c3c804f2dd02ed45a144a0e4f1e61da185 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 b09804f23a08fc8a5e6c1d0b17eee4707f08f1b3..9e70ee5e146d116d07db11f0fb27a41a9c15dc62 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 85a39f748d8657d2f3313af3ac8b305f914fb8a1..3f7c6b8bd16965bbe7f0177cd28f13ce54c083bc 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 b2233a14eebdf19120d9eac71bd6c78ae6b9c3f4..e91ceb5da1fa008c53669abae21253297a6f9ab5 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 056b58822a6ae53c201de921faa3f71372c16417..d31b8c3d1120a3347a123b895bf805ab524f68c6 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 37b7f8e4543634353314deae0fed5b4f6a1cbec4..df4f29594f81670c62091810d6067d1c9b90aa69 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 3c413bbead94f17268097baec4111c61c74e832e..0531b0791eb84fa522943e3c72913bd6d092a3ec 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 d6a0f79587578d8f6174b83f31e4d36850693bb8..decaa8bc1c5413bb8612911159cf0a034b06fb14 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 46c30746f608e5473b12afecbba83ae6348de826..f82b5b7538080122990615986205c41648393167 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 865d089bfe4157389549df3b7fe51b9be6a4a9e4..fef68f1867d7444d2bcfd987050eb962ae65627f 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 4625b7cd8e41af4caf301fac984e07c6f8d01b3d..50b633c960226c02636708a7085c0f03298b114f 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 94291ad5bf574d2f5c70be5ac18cffdd85a08106..3364b0a34add70f19e6484be27b6ec0eb237662a 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 abf1c1c8b331af64dd5815b9d69334d1642589d5..eb28a4b90e84cd5dd1d3f527f762a298e42dbde3 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 e8e498da2ed6378ff00cf480fc51b6b5796a95d2..7e44cd6e83b895504f2e92b04391897c301aa282 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 71e95bf43e1771231dcc587f30170493239cde2f..6f34af3e5b51a889705017d228cd3b1112712ea1 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 63255254ddcb886bdc7ffa175cadee3426477f10..86aa56a38d0e68c7973135c62012c8381d8333ed 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 a06230bd41c46286b7cd22b21959de56ae337f9f..d1ad65825fe3186882fb1eea71afb07a91d1c80b 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 98cf7c9e59c7b4cdb1bf0918097f5674097e99fe..06e390a80640e4df5190afdd793b8d1646c1470f 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 0986c80e7cbe9112982435cd8e51bf21d76b07fc..4207b8a5e657d0ba27900f1ce6cfb219647339de 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 0c1d835cc15806b9c3254d03425a7563a8459567..98350708ca9156cfbb59b43880fb3fdcea39c516 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 8668207be4536ef6faf1d768f6b45a4a71c7494b..41921544536d2c6eb9e30bbdf4bce4540a276ad3 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 67643b6776722be1943ec7c18465180d0ce2e61b..f32492a38975b3070f26d6c613cc5c09069fd816 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 7bb8ef0a3963304b606e75a941fa9384a07fb589..197937496b21659bc9e7340be9fbe17727396bae 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 d562388f13fff706ad9ca1c042addc0f12eb684f..70c8461d7e9dfe95bfde26f60b5c29c62d89cbeb 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 7c07aa903bd1ae847d2663f774b741fc76926f25..6d0e1bb6f3bd636e435c1f330fc4ea1efe09f8a9 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 228276da84d8f7d3257c9b711c4d405ccf82d28a..21f8a7c7cc1f0de892979ddd57431e84e6450198 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 83baf8a43e7048aa4334f66a164cd4ae69c393a8..d7ab373560c550bd357c6ff955249354a5a6d37e 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 cd63bcc62a2951898e425b468dd3086b503f10aa..24d39942d5311fbf0ae9e4e50a19740d882f5a1c 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 40383ca7895829ca27f09b3e205aa7e5b3accd5f..221b95c5a1c617708bb82cad1f0633355d535586 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 b40e4d663c73781c44feb310c68053d61fcb4269..baa371e7664ef242e6614b8da5c721e5662e8106 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 215aa11c0b8fc0a4fa108cad8ce17f7ac0d8c1b9..0ff543297bc97157e5799d581690cb6f0b6f0c45 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 1b147ee29cf921d661623f7717b76f1678b4020c..0202fcf60834055618dc48bd0bc72dc2a88ad759 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 addec7f74f51f12ea25b049a41e66c0f14e95c80..8bdb3101be1ee371dc9a3c69faaac398648b0867 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 28da87d21741afe0d90061f9696c031b60d1346a..182ae7cfaa3c16f5ca44d8c7bf4a5f4c7d4e3aaf 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 7a59775d19197cf9d1b6380342b7493d35666257..52121e8e1adee275d8774a222b73b3b451a9b4c5 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 753f762d4acdee794f643320d8a8aa31b5f82c24..0a03e19b5efee99099d1d86fc2cd6caa5d5c32e4 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 dbdbea8efb0528bd4f3b198502f60d887c2f9fe4..3f41b0816a069bc6123869a7545e1fda45f41600 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 1f0ecc770fb67894fc907bdc40b477c2f12e5f84..74dd5b1d01a00ec6dc2aaa24c59e9fcb97426973 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 e108c7157e04e73baaa853a691d17c0cc49d7083..31425a381b91922cc83646f079fa427c882e787a 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 e38b191f15e4130c8551c25a89c445df8eee1cec..66de4c743e0f77be29d4405abd3ccb041bfe2503 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 5941919144d5cef77654d1517d05affb02cbfa0e..a0bb3be85b9b8749adfbe63bcef533a9e57062e9 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 3c5eb077efe8c8149d2c34e961a7e1a78c865579..04db92ce695059d171cae065b993082376351aca 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 9706047258829fe6fb70e660b38d066f411af8b0..18619c62eae5ab3ba0d69f43d4b1aeda1a5699cb 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 2f6a478cd167bae768fb7e15e2964cc1554213f9..ce51a6134c2c4e6504934ef2d6e686d9c12a0b75 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 96dc288770d3e7138a843367489f5849313a8a63..7a9546bb44921ca4511c1566bb825fbb3db55ff0 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 1ee7a2573cc0a77018374fe83383857eba4da3dc..eb07c56038fd8300b3067a99701cdd40da00d4d6 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 9ea1610e9def0510b6e1234acd6894a91f3f5dcc..129ec7226b417942d3e1eb7ee85b0d02f51542af 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 5e9b54a0dd193c3caabcac768fdb8879ff867fbc..bd287ddcc95b5a32d1e00ee1b1de4e396d57bead 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"); } }