* Specify locale in all toLowerCase() and toUpperCase() calls to

avoid "Turkish four i problem"
This commit is contained in:
zzz
2011-11-28 20:32:23 +00:00
parent bf461ee77e
commit d9dcb1e583
50 changed files with 157 additions and 109 deletions

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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();

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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 = "";

View File

@@ -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

View File

@@ -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()

View File

@@ -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";

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();

View File

@@ -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();

View File

@@ -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);

View File

@@ -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;

View File

@@ -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("\"> ");
}

View File

@@ -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.

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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:" ) ) {

View File

@@ -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] );
}
}

View File

@@ -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 )

View File

@@ -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";

View File

@@ -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 + "\"";

View File

@@ -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");

View File

@@ -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++;

View File

@@ -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");

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);
}
/**

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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")) {

View File

@@ -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;

View File

@@ -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"))

View File

@@ -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");
/*

View File

@@ -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"))

View File

@@ -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

View File

@@ -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)));
}
}
}

View File

@@ -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);
}

View File

@@ -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))

View File

@@ -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("\"> ");
}

View File

@@ -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)

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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");
}
}