393363 Use Locale.ENGLISH for all toUpperCase and toLowerCase calls

This commit is contained in:
Greg Wilkins 2012-11-02 13:19:07 +11:00
parent 8723408731
commit e076e8a8f0
8 changed files with 17 additions and 15 deletions

View File

@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@ -109,7 +110,7 @@ public class LibExtClassLoaderHelper
for (File f : jettyResources.listFiles())
{
jettyResFiles.put(f.getName(), f);
if (f.getName().toLowerCase().startsWith("readme"))
if (f.getName().toLowerCase(Locale.ENGLISH).startsWith("readme"))
{
continue;
}

View File

@ -32,6 +32,7 @@ import java.util.Enumeration;
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;
@ -389,7 +390,7 @@ public class OverlayedAppProvider extends AbstractLifeCycle implements AppProvid
List<URL> libs = new ArrayList<URL>();
for (String jar :instance_lib.list())
{
if (!jar.toLowerCase().endsWith(".jar"))
if (!jar.toLowerCase(Locale.ENGLISH).endsWith(".jar"))
continue;
libs.add(instance_lib.addPath(jar).getURL());
}
@ -610,7 +611,7 @@ public class OverlayedAppProvider extends AbstractLifeCycle implements AppProvid
{
for (String jar :lib.list())
{
if (!jar.toLowerCase().endsWith(".jar"))
if (!jar.toLowerCase(Locale.ENGLISH).endsWith(".jar"))
continue;
libs.add(lib.addPath(jar).getURL());
}
@ -832,12 +833,12 @@ public class OverlayedAppProvider extends AbstractLifeCycle implements AppProvid
File origin = new File(new URI(_scanDir.toURI()+ruri));
String name=origin.getName();
Monitor monitor = Monitor.valueOf(origin.getParentFile().getName().toUpperCase());
Monitor monitor = Monitor.valueOf(origin.getParentFile().getName().toUpperCase(Locale.ENGLISH));
String ext=".war";
// check directory vs archive
if (origin.isDirectory() || !origin.exists() && !ruri.toLowerCase().endsWith(ext))
if (origin.isDirectory() || !origin.exists() && !ruri.toLowerCase(Locale.ENGLISH).endsWith(ext))
{
// directories have priority over archives
directory=origin;
@ -846,7 +847,7 @@ public class OverlayedAppProvider extends AbstractLifeCycle implements AppProvid
else
{
// check extension name
if (!ruri.toLowerCase().endsWith(ext))
if (!ruri.toLowerCase(Locale.ENGLISH).endsWith(ext))
continue;
name=name.substring(0,name.length()-4);

View File

@ -371,7 +371,7 @@ public class ProxyRule extends PatternRule
{
// TODO could be better than this!
String hdr = (String)enm.nextElement();
String lhdr = hdr.toLowerCase();
String lhdr = hdr.toLowerCase(Locale.ENGLISH);
if (_DontProxyHeaders.contains(lhdr))
continue;

View File

@ -561,7 +561,7 @@ public class ProxyServlet implements Servlet
String connectionHdr = request.getHeader("Connection");
if (connectionHdr != null)
{
connectionHdr = connectionHdr.toLowerCase();
connectionHdr = connectionHdr.toLowerCase(Locale.ENGLISH);
if (connectionHdr.indexOf("keep-alive") < 0 && connectionHdr.indexOf("close") < 0)
connectionHdr = null;
}
@ -579,7 +579,7 @@ public class ProxyServlet implements Servlet
{
// TODO could be better than this!
String hdr = (String)enm.nextElement();
String lhdr = hdr.toLowerCase();
String lhdr = hdr.toLowerCase(Locale.ENGLISH);
if (_DontProxyHeaders.contains(lhdr))
continue;

View File

@ -386,7 +386,7 @@ public class Main
return false;
}
String name = path.getName(Locale.ENGLISH).toLowerCase();
String name = path.getName().toLowerCase(Locale.ENGLISH);
return (name.startsWith("jetty") && name.endsWith(".xml"));
}
});

View File

@ -181,7 +181,7 @@ public class MultiPartInputStream
{
if (name == null)
return null;
return (String)_headers.getValue(name.toLowerCase(), 0);
return (String)_headers.getValue(name.toLowerCase(Locale.ENGLISH), 0);
}
/**
@ -505,7 +505,7 @@ public class MultiPartInputStream
int c=line.indexOf(':',0);
if(c>0)
{
String key=line.substring(0,c).trim().toLowerCase();
String key=line.substring(0,c).trim().toLowerCase(Locale.ENGLISH);
String value=line.substring(c+1,line.length()).trim();
headers.put(key, value);
if (key.equalsIgnoreCase("content-disposition"))
@ -531,7 +531,7 @@ public class MultiPartInputStream
while(tok.hasMoreTokens())
{
String t=tok.nextToken().trim();
String tl=t.toLowerCase();
String tl=t.toLowerCase(Locale.ENGLISH);
if(t.startsWith("form-data"))
form_data=true;
else if(tl.startsWith("name="))

View File

@ -135,7 +135,7 @@ public class JSONPojoConvertor implements JSON.Convertor
case 1:
if (name.startsWith("set") && name.length()>3)
{
name=name.substring(3,4).toLowerCase()+name.substring(4);
name=name.substring(3,4).toLowerCase(Locale.ENGLISH)+name.substring(4);
if(includeField(name, m))
addSetter(name, m);
}

View File

@ -101,7 +101,7 @@ public class Dump extends HttpServlet
final boolean flush= request.getParameter("flush")!=null?Boolean.parseBoolean(request.getParameter("flush")):false;
if(request.getPathInfo()!=null && request.getPathInfo().toLowerCase().indexOf("script")!=-1)
if(request.getPathInfo()!=null && request.getPathInfo().toLowerCase(Locale.ENGLISH).indexOf("script")!=-1)
{
response.sendRedirect(response.encodeRedirectURL(getServletContext().getContextPath() + "/dump/info"));
return;