提交 1b3c1f92 编写于 作者: K kohsuke

[HUDSON-5391] Fixed the infamous Turkish bug.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@26650 71c3de6d-444a-0410-be80-ed276b4c234a
上级 af12705d
......@@ -46,6 +46,7 @@ import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Arrays;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
......@@ -99,7 +100,7 @@ public class LogRecorder extends AbstractModelObject implements Saveable {
@DataBoundConstructor
public Target(String name, String level) {
this(name,Level.parse(level.toUpperCase()));
this(name,Level.parse(level.toUpperCase(Locale.ENGLISH)));
}
public Level getLevel() {
......
......@@ -49,6 +49,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.LogRecord;
......@@ -123,7 +124,7 @@ public class LogRecorderManager extends AbstractModelObject {
if(level.equals("inherit"))
lv = null;
else
lv = Level.parse(level.toUpperCase());
lv = Level.parse(level.toUpperCase(Locale.ENGLISH));
Logger.getLogger(name).setLevel(lv);
return new HttpRedirect("levels");
}
......
......@@ -28,6 +28,7 @@ import hudson.util.KeyedDataStorage;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
/**
......@@ -77,7 +78,7 @@ public final class FingerprintMap extends KeyedDataStorage<Fingerprint,Fingerpri
// sanity check
if(md5sum.length()!=32)
return null; // illegal input
md5sum = md5sum.toLowerCase();
md5sum = md5sum.toLowerCase(Locale.ENGLISH);
return super.get(md5sum,createIfNotExist,createParams);
}
......
......@@ -196,6 +196,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.Map.Entry;
import java.util.Properties;
......@@ -3293,7 +3294,7 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
public static boolean isDarwin() {
// according to http://developer.apple.com/technotes/tn2002/tn2110.html
return System.getProperty("os.name").toLowerCase().startsWith("mac");
return System.getProperty("os.name").toLowerCase(Locale.ENGLISH).startsWith("mac");
}
/**
......
......@@ -35,6 +35,7 @@ import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
import java.awt.*;
import java.util.Locale;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.chart.JFreeChart;
......@@ -178,7 +179,7 @@ public class MultiStageTimeSeries {
*/
public static TimeScale parse(String type) {
if(type==null) return TimeScale.MIN;
return Enum.valueOf(TimeScale.class, type.toUpperCase());
return Enum.valueOf(TimeScale.class, type.toUpperCase(Locale.ENGLISH));
}
}
......
......@@ -36,6 +36,7 @@ import java.io.IOException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Locale;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.export.Exported;
......@@ -106,7 +107,7 @@ import org.kohsuke.stapler.export.Exported;
* If failed to parse.
*/
public static DiskSpace parse(String size) throws ParseException {
size = size.toUpperCase().trim();
size = size.toUpperCase(Locale.ENGLISH).trim();
if (size.endsWith("B")) // cut off 'B' from KB, MB, etc.
size = size.substring(0,size.length()-1);
......
......@@ -423,7 +423,7 @@ public class JDKInstaller extends ToolInstaller {
}
public static Platform current() throws DetectionFailedException {
String arch = System.getProperty("os.name").toLowerCase();
String arch = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if(arch.contains("linux")) return LINUX;
if(arch.contains("windows")) return WINDOWS;
if(arch.contains("sun") || arch.contains("solaris")) return SOLARIS;
......@@ -480,7 +480,7 @@ public class JDKInstaller extends ToolInstaller {
* http://lopica.sourceforge.net/os.html was useful in writing this code.
*/
public static CPU current() throws DetectionFailedException {
String arch = System.getProperty("os.arch").toLowerCase();
String arch = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH);
if(arch.contains("sparc")) return Sparc;
if(arch.contains("ia64")) return Itanium;
if(arch.contains("amd64") || arch.contains("86_64")) return amd64;
......
......@@ -42,6 +42,7 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.Locale;
import javax.servlet.ServletException;
......@@ -295,7 +296,7 @@ public abstract class FormFieldValidator {
*/
private String getCharset(URLConnection con) {
for( String t : con.getContentType().split(";") ) {
t = t.trim().toLowerCase();
t = t.trim().toLowerCase(Locale.ENGLISH);
if(t.startsWith("charset="))
return t.substring(8);
}
......
......@@ -45,6 +45,7 @@ import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Locale;
/**
* Represents the result of the form field validation.
......@@ -189,7 +190,7 @@ public abstract class FormValidation extends IOException implements HttpResponse
return new FormValidation(kind) {
public String renderHtml() {
// 1x16 spacer needed for IE since it doesn't support min-height
return "<div class="+ kind.name().toLowerCase() +"><img src='"+
return "<div class="+ kind.name().toLowerCase(Locale.ENGLISH) +"><img src='"+
Stapler.getCurrentRequest().getContextPath()+ Hudson.RESOURCE_PATH+"/images/none.gif' height=16 width=1>"+
message+"</div>";
}
......@@ -403,7 +404,7 @@ public abstract class FormValidation extends IOException implements HttpResponse
*/
private String getCharset(URLConnection con) {
for( String t : con.getContentType().split(";") ) {
t = t.trim().toLowerCase();
t = t.trim().toLowerCase(Locale.ENGLISH);
if(t.startsWith("charset="))
return t.substring(8);
}
......
......@@ -30,6 +30,7 @@ import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.apache.commons.jelly.XMLOutput;
import java.util.Locale;
import java.util.Stack;
import java.util.Map;
import java.util.HashMap;
......@@ -71,7 +72,7 @@ public class TableNestChecker extends XMLFilterImpl {
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
String tagName = localName.toUpperCase();
String tagName = localName.toUpperCase(Locale.ENGLISH);
// make sure that this tag occurs in the proper context
if(!elements.peek().isAllowed(tagName))
......
......@@ -35,6 +35,7 @@
*/
package hudson.util;
import java.util.Locale;
import java.util.StringTokenizer;
/**
......@@ -78,7 +79,7 @@ public class VersionNumber implements Comparable<VersionNumber> {
int i=0;
while( tokens.hasMoreTokens() ) {
String token = tokens.nextToken().toLowerCase();
String token = tokens.nextToken().toLowerCase(Locale.ENGLISH);
if(token.equals("*")) {
digits[i++] = 1000;
} else
......
......@@ -61,6 +61,7 @@ import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.security.cert.X509Certificate;
......@@ -90,7 +91,7 @@ public class Launcher {
"Useful for running slave over 8-bit unsafe protocol like telnet")
public void setTextMode(boolean b) {
mode = b?Mode.TEXT:Mode.BINARY;
System.out.println("Running in "+mode.name().toLowerCase()+" mode");
System.out.println("Running in "+mode.name().toLowerCase(Locale.ENGLISH)+" mode");
}
@Option(name="-jnlpUrl",usage="instead of talking to the master via stdin/stdout, " +
......
......@@ -30,6 +30,7 @@ import com.gargoylesoftware.htmlunit.WebWindow;
import com.gargoylesoftware.htmlunit.PageCreator;
import java.io.IOException;
import java.util.Locale;
/**
* {@link PageCreator} that understands JNLP file.
......@@ -39,7 +40,7 @@ import java.io.IOException;
public class HudsonPageCreator extends DefaultPageCreator {
@Override
public Page createPage(WebResponse webResponse, WebWindow webWindow) throws IOException {
String contentType = webResponse.getContentType().toLowerCase();
String contentType = webResponse.getContentType().toLowerCase(Locale.ENGLISH);
if(contentType.equals("application/x-java-jnlp-file"))
return createXmlPage(webResponse, webWindow);
return super.createPage(webResponse, webWindow);
......
......@@ -30,6 +30,7 @@ import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import java.util.Locale;
/**
* Runs a test case with one of the preset HUDSON_HOME data set.
......@@ -62,7 +63,7 @@ public @interface PresetData {
public class RunnerImpl extends Recipe.Runner<PresetData> {
public void setup(HudsonTestCase testCase, PresetData recipe) {
testCase.withPresetData(recipe.value().name().toLowerCase().replace('_','-'));
testCase.withPresetData(recipe.value().name().toLowerCase(Locale.ENGLISH).replace('_','-'));
}
}
}
......@@ -42,6 +42,7 @@ import org.jvnet.hudson.test.recipes.PresetData.DataSet;
import java.net.URL;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
/**
* Makes sure that the jars that web start needs are readable, even when the anonymous user doesn't have any read access.
......@@ -77,7 +78,7 @@ public class JnlpAccessWithSecuredHudsonTest extends HudsonTestCase {
// now make sure that these URLs are unprotected
Page jarResource = jnlpAgent.getPage(url);
assertTrue(jarResource.getWebResponse().getContentType().toLowerCase().startsWith("application/"));
assertTrue(jarResource.getWebResponse().getContentType().toLowerCase(Locale.ENGLISH).startsWith("application/"));
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册