forked from I2P_Developers/i2p.i2p
* Specify locale in all toLowerCase() and toUpperCase() calls to
avoid "Turkish four i problem"
This commit is contained in:
@ -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
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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("\"> ");
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user