git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@911324 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -37,7 +37,6 @@ import java.util.Hashtable; | |||
| import java.util.Map; | |||
| import java.util.StringTokenizer; | |||
| import java.util.Vector; | |||
| import java.util.Locale; | |||
| import java.util.jar.Attributes; | |||
| import java.util.jar.Attributes.Name; | |||
| import java.util.jar.JarEntry; | |||
| @@ -1280,7 +1279,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener { | |||
| sealedString = mainAttributes.getValue(Name.SEALED); | |||
| } | |||
| } | |||
| if (sealedString != null && sealedString.toLowerCase(Locale.ENGLISH).equals("true")) { | |||
| if (sealedString != null && sealedString.equalsIgnoreCase("true")) { | |||
| try { | |||
| sealBase = new URL(FileUtils.getFileUtils().toURI(container.getAbsolutePath())); | |||
| } catch (MalformedURLException e) { | |||
| @@ -32,7 +32,6 @@ import java.util.Vector; | |||
| import java.util.Set; | |||
| import java.util.HashSet; | |||
| import java.util.HashMap; | |||
| import java.util.Locale; | |||
| import java.util.Map; | |||
| import java.util.WeakHashMap; | |||
| import org.apache.tools.ant.input.DefaultInputHandler; | |||
| @@ -1715,10 +1714,9 @@ public class Project implements ResourceFactory { | |||
| * <code>false</code> otherwise. | |||
| */ | |||
| public static boolean toBoolean(String s) { | |||
| String lc = s == null ? null : s.toLowerCase(Locale.ENGLISH); | |||
| return ("on".equals(lc) | |||
| || "true".equals(lc) | |||
| || "yes".equals(lc)); | |||
| return ("on".equalsIgnoreCase(s) | |||
| || "true".equalsIgnoreCase(s) | |||
| || "yes".equalsIgnoreCase(s)); | |||
| } | |||
| /** | |||
| @@ -47,10 +47,6 @@ public class ProjectHelper { | |||
| /** Polymorphic attribute */ | |||
| public static final String ANT_TYPE = "ant-type"; | |||
| /** Lowercase version of {@link ANT_TYPE} used for comparisons */ | |||
| public static final String ANT_TYPE_LC = | |||
| ANT_TYPE.toLowerCase(Locale.ENGLISH); | |||
| /** | |||
| * Name of JVM system property which provides the name of the | |||
| * ProjectHelper class to use. | |||
| @@ -24,7 +24,6 @@ import java.util.HashSet; | |||
| import java.util.Hashtable; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| import java.util.Locale; | |||
| import java.util.Set; | |||
| import java.util.Vector; | |||
| import java.util.Enumeration; | |||
| @@ -1146,13 +1145,13 @@ public class PropertyHelper implements GetProperty { | |||
| return (Boolean) value; | |||
| } | |||
| if (value instanceof String) { | |||
| String s = ((String) value).toLowerCase(Locale.ENGLISH); | |||
| String s = (String) value; | |||
| if (Project.toBoolean(s)) { | |||
| return Boolean.TRUE; | |||
| } | |||
| if ("off".equals(s) | |||
| || "false".equals(s) | |||
| || "no".equals(s)) { | |||
| if ("off".equalsIgnoreCase(s) | |||
| || "false".equalsIgnoreCase(s) | |||
| || "no".equalsIgnoreCase(s)) { | |||
| return Boolean.FALSE; | |||
| } | |||
| } | |||
| @@ -25,7 +25,6 @@ import java.util.Enumeration; | |||
| import java.util.HashMap; | |||
| import java.util.Hashtable; | |||
| import java.util.List; | |||
| import java.util.Locale; | |||
| import java.util.Map; | |||
| import java.util.Iterator; | |||
| @@ -185,15 +184,14 @@ public class RuntimeConfigurable implements Serializable { | |||
| * @param value the attribute's value. | |||
| */ | |||
| public synchronized void setAttribute(String name, String value) { | |||
| String nameLC = name.toLowerCase(Locale.ENGLISH); | |||
| if (nameLC.equals(ProjectHelper.ANT_TYPE_LC)) { | |||
| if (name.equalsIgnoreCase(ProjectHelper.ANT_TYPE)) { | |||
| this.polyType = value; | |||
| } else { | |||
| if (attributeNames == null) { | |||
| attributeNames = new ArrayList(); | |||
| attributeMap = new HashMap(); | |||
| } | |||
| if (nameLC.equals("refid")) { | |||
| if (name.equalsIgnoreCase("refid")) { | |||
| attributeNames.add(0, name); | |||
| } else { | |||
| attributeNames.add(name); | |||
| @@ -501,7 +501,7 @@ public class Available extends Task implements Condition { | |||
| * @return true if the value specifies a directory. | |||
| */ | |||
| public boolean isDir() { | |||
| return equalsIgnoreCase("dir", getValue()); | |||
| return "dir".equalsIgnoreCase(getValue()); | |||
| } | |||
| /** | |||
| @@ -510,7 +510,7 @@ public class Available extends Task implements Condition { | |||
| * @return true if the value specifies a file. | |||
| */ | |||
| public boolean isFile() { | |||
| return equalsIgnoreCase("file", getValue()); | |||
| return "file".equalsIgnoreCase(getValue()); | |||
| } | |||
| } | |||
| @@ -19,7 +19,6 @@ package org.apache.tools.ant.taskdefs; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| @@ -40,8 +39,6 @@ public class Ear extends Jar { | |||
| private File deploymentDescriptor; | |||
| private boolean descriptorAdded; | |||
| private static final String XML_DESCRIPTOR_PATH = "META-INF/application.xml"; | |||
| private static final String XML_DESCRIPTOR_PATH_LC = | |||
| XML_DESCRIPTOR_PATH.toLowerCase(Locale.ENGLISH); | |||
| /** | |||
| * Create an Ear task. | |||
| @@ -127,8 +124,7 @@ public class Ear extends Jar { | |||
| // attribute - or if it's being added twice, meaning the same | |||
| // file is specified by the "appxml" attribute and in a | |||
| // <fileset> element. | |||
| String vPathLowerCase = vPath.toLowerCase(Locale.ENGLISH); | |||
| if (XML_DESCRIPTOR_PATH_LC.equals(vPathLowerCase)) { | |||
| if (XML_DESCRIPTOR_PATH.equalsIgnoreCase(vPath)) { | |||
| if (deploymentDescriptor == null | |||
| || !FILE_UTILS.fileNameEquals(deploymentDescriptor, file) | |||
| || descriptorAdded) { | |||
| @@ -20,7 +20,6 @@ package org.apache.tools.ant.taskdefs; | |||
| import java.io.File; | |||
| import java.io.OutputStream; | |||
| import java.io.FileOutputStream; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.BuildException; | |||
| @@ -106,8 +105,6 @@ public class EchoXML extends XMLFragment { | |||
| public static class NamespacePolicy extends EnumeratedAttribute { | |||
| private static final String IGNORE = "ignore"; | |||
| private static final String ELEMENTS = "elementsOnly"; | |||
| private static final String ELEMENTS_LC = | |||
| ELEMENTS.toLowerCase(Locale.ENGLISH); | |||
| private static final String ALL = "all"; | |||
| public static final NamespacePolicy DEFAULT | |||
| @@ -124,14 +121,13 @@ public class EchoXML extends XMLFragment { | |||
| } | |||
| public DOMElementWriter.XmlNamespacePolicy getPolicy() { | |||
| String v = getValue(); | |||
| String s = v != null ? v.toLowerCase(Locale.ENGLISH) : null; | |||
| if (IGNORE.equals(s)) { | |||
| String s = getValue(); | |||
| if (IGNORE.equalsIgnoreCase(s)) { | |||
| return DOMElementWriter.XmlNamespacePolicy.IGNORE; | |||
| } else if (ELEMENTS_LC.equals(s)) { | |||
| } else if (ELEMENTS.equalsIgnoreCase(s)) { | |||
| return | |||
| DOMElementWriter.XmlNamespacePolicy.ONLY_QUALIFY_ELEMENTS; | |||
| } else if (ALL.equals(s)) { | |||
| } else if (ALL.equalsIgnoreCase(s)) { | |||
| return DOMElementWriter.XmlNamespacePolicy.QUALIFY_ALL; | |||
| } else { | |||
| throw new BuildException("Invalid namespace policy: " + s); | |||
| @@ -37,7 +37,6 @@ import java.util.Enumeration; | |||
| import java.util.HashSet; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| import java.util.Locale; | |||
| import java.util.StringTokenizer; | |||
| import java.util.TreeMap; | |||
| import java.util.Vector; | |||
| @@ -342,7 +341,7 @@ public class Jar extends Zip { | |||
| Enumeration e = zf.entries(); | |||
| while (e.hasMoreElements()) { | |||
| ZipEntry ze = (ZipEntry) e.nextElement(); | |||
| if (ze.getName().toUpperCase(Locale.ENGLISH).equals(MANIFEST_NAME)) { | |||
| if (ze.getName().equalsIgnoreCase(MANIFEST_NAME)) { | |||
| InputStreamReader isr = | |||
| new InputStreamReader(zf.getInputStream(ze), "UTF-8"); | |||
| return getManifest(isr); | |||
| @@ -383,7 +382,7 @@ public class Jar extends Zip { | |||
| Enumeration e = zf.entries(); | |||
| while (e.hasMoreElements()) { | |||
| ZipEntry ze = (ZipEntry) e.nextElement(); | |||
| if (ze.getName().toUpperCase(Locale.ENGLISH).equals(INDEX_NAME)) { | |||
| if (ze.getName().equalsIgnoreCase(INDEX_NAME)) { | |||
| return true; | |||
| } | |||
| } | |||
| @@ -693,12 +692,11 @@ public class Jar extends Zip { | |||
| protected void zipFile(InputStream is, ZipOutputStream zOut, String vPath, | |||
| long lastModified, File fromArchive, int mode) | |||
| throws IOException { | |||
| String vPathUC = vPath != null ? vPath.toUpperCase(Locale.ENGLISH) : null; | |||
| if (MANIFEST_NAME.equals(vPathUC)) { | |||
| if (MANIFEST_NAME.equalsIgnoreCase(vPath)) { | |||
| if (isFirstPass()) { | |||
| filesetManifest(fromArchive, is); | |||
| } | |||
| } else if (INDEX_NAME.equals(vPathUC) && index) { | |||
| } else if (INDEX_NAME.equalsIgnoreCase(vPath) && index) { | |||
| logWhenWriting("Warning: selected " + archiveType | |||
| + " files include a " + INDEX_NAME + " which will" | |||
| + " be replaced by a newly generated one.", | |||
| @@ -967,7 +965,7 @@ public class Jar extends Zip { | |||
| message.append(br); | |||
| message.append("Location: ").append(getLocation()); | |||
| message.append(br); | |||
| if (strict.getValue().toLowerCase(Locale.ENGLISH).equals("fail")) { | |||
| if (strict.getValue().equalsIgnoreCase("fail")) { | |||
| throw new BuildException(message.toString(), getLocation()); | |||
| } else { | |||
| logWhenWriting(message.toString(), strict.getLogLevel()); | |||
| @@ -1169,8 +1167,7 @@ public class Jar extends Zip { | |||
| }); | |||
| } | |||
| for (int j = 0; j < resources[0].length; j++) { | |||
| if (resources[0][j].getName().toUpperCase(Locale.ENGLISH) | |||
| .equals(MANIFEST_NAME)) { | |||
| if (resources[0][j].getName().equalsIgnoreCase(MANIFEST_NAME)) { | |||
| manifests[i] = new Resource[] {resources[0][j]}; | |||
| break; | |||
| } | |||
| @@ -24,7 +24,6 @@ import java.io.IOException; | |||
| import java.io.OutputStream; | |||
| import java.util.HashMap; | |||
| import java.util.Iterator; | |||
| import java.util.Locale; | |||
| import java.util.Map; | |||
| import org.apache.tools.ant.BuildException; | |||
| @@ -89,8 +88,6 @@ public class Javac extends MatchingTask { | |||
| private static final String MODERN = "modern"; | |||
| private static final String CLASSIC = "classic"; | |||
| private static final String EXTJAVAC = "extJavac"; | |||
| private static final String EXTJAVAC_LC = | |||
| EXTJAVAC.toLowerCase(Locale.ENGLISH); | |||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||
| @@ -682,9 +679,7 @@ public class Javac extends MatchingTask { | |||
| * @return true if this is a forked invocation | |||
| */ | |||
| public boolean isForkedJavac() { | |||
| String c = getCompiler(); | |||
| return fork || | |||
| (c != null && EXTJAVAC_LC.equals(c.toLowerCase(Locale.ENGLISH))); | |||
| return fork || EXTJAVAC.equalsIgnoreCase(getCompiler()); | |||
| } | |||
| /** | |||
| @@ -763,31 +758,29 @@ public class Javac extends MatchingTask { | |||
| } | |||
| private String getAltCompilerName(String anImplementation) { | |||
| anImplementation = anImplementation != null | |||
| ? anImplementation.toLowerCase(Locale.ENGLISH) : null; | |||
| if (JAVAC16.equals(anImplementation) | |||
| || JAVAC15.equals(anImplementation) | |||
| || JAVAC14.equals(anImplementation) | |||
| || JAVAC13.equals(anImplementation)) { | |||
| if (JAVAC16.equalsIgnoreCase(anImplementation) | |||
| || JAVAC15.equalsIgnoreCase(anImplementation) | |||
| || JAVAC14.equalsIgnoreCase(anImplementation) | |||
| || JAVAC13.equalsIgnoreCase(anImplementation)) { | |||
| return MODERN; | |||
| } | |||
| if (JAVAC12.equals(anImplementation) | |||
| || JAVAC11.equals(anImplementation)) { | |||
| if (JAVAC12.equalsIgnoreCase(anImplementation) | |||
| || JAVAC11.equalsIgnoreCase(anImplementation)) { | |||
| return CLASSIC; | |||
| } | |||
| if (MODERN.equals(anImplementation)) { | |||
| if (MODERN.equalsIgnoreCase(anImplementation)) { | |||
| String nextSelected = assumedJavaVersion(); | |||
| if (JAVAC16.equals(nextSelected) | |||
| || JAVAC15.equals(nextSelected) | |||
| || JAVAC14.equals(nextSelected) | |||
| || JAVAC13.equals(nextSelected)) { | |||
| if (JAVAC16.equalsIgnoreCase(nextSelected) | |||
| || JAVAC15.equalsIgnoreCase(nextSelected) | |||
| || JAVAC14.equalsIgnoreCase(nextSelected) | |||
| || JAVAC13.equalsIgnoreCase(nextSelected)) { | |||
| return nextSelected; | |||
| } | |||
| } | |||
| if (CLASSIC.equals(anImplementation)) { | |||
| if (CLASSIC.equalsIgnoreCase(anImplementation)) { | |||
| return assumedJavaVersion(); | |||
| } | |||
| if (EXTJAVAC_LC.equals(anImplementation)) { | |||
| if (EXTJAVAC.equalsIgnoreCase(anImplementation)) { | |||
| return assumedJavaVersion(); | |||
| } | |||
| return null; | |||
| @@ -513,10 +513,8 @@ public class Manifest { | |||
| Attribute classpathAttribute = null; | |||
| while (e.hasMoreElements()) { | |||
| String attributeName = (String) e.nextElement(); | |||
| String attributeNameLC = | |||
| attributeName.toLowerCase(Locale.ENGLISH); | |||
| Attribute attribute = section.getAttribute(attributeName); | |||
| if (attributeNameLC.equals(ATTRIBUTE_CLASSPATH_LC)) { | |||
| if (attributeName.equalsIgnoreCase(ATTRIBUTE_CLASSPATH)) { | |||
| if (classpathAttribute == null) { | |||
| classpathAttribute = new Attribute(); | |||
| classpathAttribute.setName(ATTRIBUTE_CLASSPATH); | |||
| @@ -870,8 +868,7 @@ public class Manifest { | |||
| Section section = new Section(); | |||
| if (nextSectionName == null) { | |||
| Attribute sectionName = new Attribute(line); | |||
| if (!sectionName.getName().toLowerCase(Locale.ENGLISH) | |||
| .equals(ATTRIBUTE_NAME_LC)) { | |||
| if (!sectionName.getName().equalsIgnoreCase(ATTRIBUTE_NAME)) { | |||
| throw new ManifestException("Manifest sections should " | |||
| + "start with a \"" + ATTRIBUTE_NAME | |||
| + "\" attribute and not \"" | |||
| @@ -19,7 +19,6 @@ package org.apache.tools.ant.taskdefs; | |||
| import java.util.Hashtable; | |||
| import java.util.Iterator; | |||
| import java.util.Locale; | |||
| import java.util.Map; | |||
| import org.apache.tools.ant.BuildEvent; | |||
| import org.apache.tools.ant.BuildException; | |||
| @@ -102,7 +101,7 @@ public class Recorder extends Task implements SubBuildListener { | |||
| * @param action The action for the entry to take: start or stop. | |||
| */ | |||
| public void setAction(ActionChoices action) { | |||
| if (action.getValue().toLowerCase(Locale.ENGLISH).equals("start")) { | |||
| if (action.getValue().equalsIgnoreCase("start")) { | |||
| start = Boolean.TRUE; | |||
| } else { | |||
| start = Boolean.FALSE; | |||
| @@ -726,8 +726,7 @@ public class SQLExec extends JDBCTask { | |||
| StringTokenizer st = new StringTokenizer(line); | |||
| if (st.hasMoreTokens()) { | |||
| String token = st.nextToken(); | |||
| if (token != null | |||
| && "REM".equals(token.toUpperCase(Locale.ENGLISH))) { | |||
| if ("REM".equalsIgnoreCase(token)) { | |||
| continue; | |||
| } | |||
| } | |||
| @@ -871,35 +871,35 @@ public class Tar extends MatchingTask { | |||
| * @return true if value is "truncate". | |||
| */ | |||
| public boolean isTruncateMode() { | |||
| return equalsIgnoreCase(TRUNCATE, getValue()); | |||
| return TRUNCATE.equalsIgnoreCase(getValue()); | |||
| } | |||
| /** | |||
| * @return true if value is "warn". | |||
| */ | |||
| public boolean isWarnMode() { | |||
| return equalsIgnoreCase(WARN, getValue()); | |||
| return WARN.equalsIgnoreCase(getValue()); | |||
| } | |||
| /** | |||
| * @return true if value is "gnu". | |||
| */ | |||
| public boolean isGnuMode() { | |||
| return equalsIgnoreCase(GNU, getValue()); | |||
| return GNU.equalsIgnoreCase(getValue()); | |||
| } | |||
| /** | |||
| * @return true if value is "fail". | |||
| */ | |||
| public boolean isFailMode() { | |||
| return equalsIgnoreCase(FAIL, getValue()); | |||
| return FAIL.equalsIgnoreCase(getValue()); | |||
| } | |||
| /** | |||
| * @return true if value is "omit". | |||
| */ | |||
| public boolean isOmitMode() { | |||
| return equalsIgnoreCase(OMIT, getValue()); | |||
| return OMIT.equalsIgnoreCase(getValue()); | |||
| } | |||
| } | |||
| @@ -233,8 +233,7 @@ public class Touch extends Task { | |||
| } | |||
| if (dateTime != null && !dateTimeConfigured) { | |||
| long workmillis = millis; | |||
| if (dateTime != null | |||
| && "now".equals(dateTime.toLowerCase(Locale.ENGLISH))) { | |||
| if ("now".equalsIgnoreCase(dateTime)) { | |||
| workmillis = System.currentTimeMillis(); | |||
| } else { | |||
| DateFormat df = dfFactory.getPrimaryFormat(); | |||
| @@ -20,7 +20,6 @@ package org.apache.tools.ant.taskdefs; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.types.ZipFileSet; | |||
| @@ -61,9 +60,6 @@ public class War extends Jar { | |||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||
| /** path to web.xml file */ | |||
| private static final String XML_DESCRIPTOR_PATH = "WEB-INF/web.xml"; | |||
| /** lower case version for comparisons */ | |||
| private static final String XML_DESCRIPTOR_PATH_LC = | |||
| XML_DESCRIPTOR_PATH.toLowerCase(Locale.ENGLISH); | |||
| /** Constructor for the War Task. */ | |||
| public War() { | |||
| @@ -178,10 +174,9 @@ public class War extends Jar { | |||
| // not the one specified in the "webxml" attribute - or if | |||
| // it's being added twice, meaning the same file is specified | |||
| // by the "webxml" attribute and in a <fileset> element. | |||
| String vPathLowerCase = vPath.toLowerCase(Locale.ENGLISH); | |||
| //by default, we add the file. | |||
| boolean addFile = true; | |||
| if (XML_DESCRIPTOR_PATH_LC.equals(vPathLowerCase)) { | |||
| if (XML_DESCRIPTOR_PATH.equalsIgnoreCase(vPath)) { | |||
| //a web.xml file was found. See if it is a duplicate or not | |||
| if (addedWebXmlFile != null) { | |||
| //a second web.xml file, so skip it | |||
| @@ -20,7 +20,6 @@ package org.apache.tools.ant.taskdefs; | |||
| import java.io.File; | |||
| import java.util.Enumeration; | |||
| import java.util.Iterator; | |||
| import java.util.Locale; | |||
| import java.util.Vector; | |||
| import org.apache.tools.ant.AntClassLoader; | |||
| import org.apache.tools.ant.BuildException; | |||
| @@ -1367,18 +1366,14 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| */ | |||
| public void setDynamicAttribute(String name, String value) throws BuildException { | |||
| // only 'name' and 'value' exist. | |||
| String nameLC = name != null | |||
| ? name.toLowerCase(Locale.ENGLISH) : null; | |||
| if ("name".equals(nameLC)) { | |||
| if ("name".equalsIgnoreCase(name)) { | |||
| this.name = value; | |||
| } else if ("value".equals(nameLC)) { | |||
| } else if ("value".equalsIgnoreCase(name)) { | |||
| // a value must be of a given type | |||
| // say boolean|integer|string that are mostly used. | |||
| String valueLC = value != null | |||
| ? value.toLowerCase(Locale.ENGLISH) : null; | |||
| if ("true".equals(valueLC)) { | |||
| if ("true".equalsIgnoreCase(value)) { | |||
| this.value = Boolean.TRUE; | |||
| } else if ("false".equals(valueLC)) { | |||
| } else if ("false".equalsIgnoreCase(value)) { | |||
| this.value = Boolean.FALSE; | |||
| } else { | |||
| try { | |||
| @@ -18,7 +18,6 @@ | |||
| package org.apache.tools.ant.taskdefs.compilers; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| @@ -99,29 +98,28 @@ public final class CompilerAdapterFactory { | |||
| public static CompilerAdapter getCompiler(String compilerType, Task task, | |||
| Path classpath) | |||
| throws BuildException { | |||
| String compilerTypeLC = compilerType.toLowerCase(Locale.ENGLISH); | |||
| if (compilerTypeLC.equals("jikes")) { | |||
| if (compilerType.equalsIgnoreCase("jikes")) { | |||
| return new Jikes(); | |||
| } | |||
| if (compilerTypeLC.equals("extjavac")) { | |||
| if (compilerType.equalsIgnoreCase("extjavac")) { | |||
| return new JavacExternal(); | |||
| } | |||
| if (compilerTypeLC.equals("classic") | |||
| || compilerTypeLC.equals("javac1.1") | |||
| || compilerTypeLC.equals("javac1.2")) { | |||
| if (compilerType.equalsIgnoreCase("classic") | |||
| || compilerType.equalsIgnoreCase("javac1.1") | |||
| || compilerType.equalsIgnoreCase("javac1.2")) { | |||
| task.log("This version of java does " | |||
| + "not support the classic " | |||
| + "compiler; upgrading to modern", | |||
| Project.MSG_WARN); | |||
| compilerTypeLC = "modern"; | |||
| compilerType = "modern"; | |||
| } | |||
| //on java<=1.3 the modern falls back to classic if it is not found | |||
| //but on java>=1.4 we just bail out early | |||
| if (compilerTypeLC.equals("modern") | |||
| || compilerTypeLC.equals("javac1.3") | |||
| || compilerTypeLC.equals("javac1.4") | |||
| || compilerTypeLC.equals("javac1.5") | |||
| || compilerTypeLC.equals("javac1.6")) { | |||
| if (compilerType.equalsIgnoreCase("modern") | |||
| || compilerType.equalsIgnoreCase("javac1.3") | |||
| || compilerType.equalsIgnoreCase("javac1.4") | |||
| || compilerType.equalsIgnoreCase("javac1.5") | |||
| || compilerType.equalsIgnoreCase("javac1.6")) { | |||
| // does the modern compiler exist? | |||
| if (doesModernCompilerExist()) { | |||
| return new Javac13(); | |||
| @@ -139,18 +137,18 @@ public final class CompilerAdapterFactory { | |||
| } | |||
| } | |||
| if (compilerTypeLC.equals("jvc") | |||
| || compilerTypeLC.equals("microsoft")) { | |||
| if (compilerType.equalsIgnoreCase("jvc") | |||
| || compilerType.equalsIgnoreCase("microsoft")) { | |||
| return new Jvc(); | |||
| } | |||
| if (compilerTypeLC.equals("kjc")) { | |||
| if (compilerType.equalsIgnoreCase("kjc")) { | |||
| return new Kjc(); | |||
| } | |||
| if (compilerTypeLC.equals("gcj")) { | |||
| if (compilerType.equalsIgnoreCase("gcj")) { | |||
| return new Gcj(); | |||
| } | |||
| if (compilerTypeLC.equals("sj") | |||
| || compilerTypeLC.equals("symantec")) { | |||
| if (compilerType.equalsIgnoreCase("sj") | |||
| || compilerType.equalsIgnoreCase("symantec")) { | |||
| return new Sj(); | |||
| } | |||
| return resolveClassName(compilerType, | |||
| @@ -22,7 +22,6 @@ import java.text.DateFormat; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| @@ -120,8 +119,7 @@ public class IsLastModified extends ProjectComponent implements Condition { | |||
| if (millis >= 0) { | |||
| return millis; | |||
| } | |||
| if (dateTime != null | |||
| && "now".equals(dateTime.toLowerCase(Locale.ENGLISH))) { | |||
| if ("now".equalsIgnoreCase(dateTime)) { | |||
| return System.currentTimeMillis(); | |||
| } | |||
| DateFormat df = dfFactory.getPrimaryFormat(); | |||
| @@ -20,7 +20,6 @@ | |||
| package org.apache.tools.ant.taskdefs.optional.ejb; | |||
| import java.io.File; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| @@ -168,7 +167,7 @@ public class BorlandGenerateClient extends Task { | |||
| log("client jar file is " + clientjarfile); | |||
| if (mode.toLowerCase(Locale.ENGLISH).equals(FORK_MODE)) { | |||
| if (mode.equalsIgnoreCase(FORK_MODE)) { | |||
| executeFork(); | |||
| } else { | |||
| executeJava(); | |||
| @@ -408,10 +408,9 @@ public class Image extends MatchingTask { | |||
| if (srcDir == null && destDir == null) { | |||
| throw new BuildException("Specify the destDir, or the srcDir."); | |||
| } | |||
| String enc = str_encoding.toLowerCase(Locale.ENGLISH); | |||
| if (enc.equals("jpg")) { | |||
| if (str_encoding.equalsIgnoreCase("jpg")) { | |||
| str_encoding = "JPEG"; | |||
| } else if (enc.equals("tif")) { | |||
| } else if (str_encoding.equalsIgnoreCase("tif")) { | |||
| str_encoding = "TIFF"; | |||
| } | |||
| } | |||
| @@ -17,7 +17,6 @@ | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.jsp.compilers; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.AntClassLoader; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Task; | |||
| @@ -81,12 +80,11 @@ public final class JspCompilerAdapterFactory { | |||
| AntClassLoader loader) | |||
| throws BuildException { | |||
| String compilerTypeLC = compilerType.toLowerCase(Locale.ENGLISH); | |||
| if (compilerTypeLC.equals("jasper")) { | |||
| if (compilerType.equalsIgnoreCase("jasper")) { | |||
| //tomcat4.0 gets the old mangler | |||
| return new JasperC(new JspNameMangler()); | |||
| } | |||
| if (compilerTypeLC.equals("jasper41")) { | |||
| if (compilerType.equalsIgnoreCase("jasper41")) { | |||
| //tomcat4.1 gets the new one | |||
| return new JasperC(new Jasper41Mangler()); | |||
| } | |||
| @@ -39,7 +39,6 @@ import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.Properties; | |||
| import java.util.Vector; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.AntClassLoader; | |||
| import org.apache.tools.ant.BuildException; | |||
| @@ -1078,8 +1077,7 @@ public class JUnitTask extends Task { | |||
| * @return true if the run should be withoutput and error | |||
| */ | |||
| private boolean equalsWithOutAndErr(String summaryOption) { | |||
| return summaryOption != null && "withoutanderr".equals( | |||
| summaryOption.toLowerCase(Locale.ENGLISH)); | |||
| return "withoutanderr".equalsIgnoreCase(summaryOption); | |||
| } | |||
| private void checkIncludeSummary(CommandlineJava cmd) { | |||
| @@ -1569,9 +1567,7 @@ public class JUnitTask extends Task { | |||
| if (summary) { | |||
| JUnitTaskMirror.SummaryJUnitResultFormatterMirror f = | |||
| delegate.newSummaryJUnitResultFormatter(); | |||
| String s = summaryValue != null | |||
| ? summaryValue.toLowerCase(Locale.ENGLISH) : null; | |||
| f.setWithOutAndErr("withoutanderr".equals(s)); | |||
| f.setWithOutAndErr(equalsWithOutAndErr(summaryValue)); | |||
| delegate.addVmExit(test, f, getDefaultOutput(), message, testCase); | |||
| } | |||
| } finally { | |||
| @@ -1536,9 +1536,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||
| * synonym for -1. | |||
| */ | |||
| public void setRetriesAllowed(String retriesAllowed) { | |||
| String r = retriesAllowed != null | |||
| ? retriesAllowed.toUpperCase(Locale.ENGLISH) : null; | |||
| if ("FOREVER".equals(r)) { | |||
| if ("FOREVER".equalsIgnoreCase(retriesAllowed)) { | |||
| this.retriesAllowed = Retryable.RETRY_FOREVER; | |||
| } else { | |||
| try { | |||
| @@ -2571,7 +2569,6 @@ public class FTP extends Task implements FTPTaskConfig { | |||
| */ | |||
| public int getAction() { | |||
| String actionL = getValue().toLowerCase(Locale.ENGLISH); | |||
| if (actionL.equals("send") || actionL.equals("put")) { | |||
| return SEND_FILES; | |||
| } else if (actionL.equals("recv") || actionL.equals("get")) { | |||
| @@ -2630,7 +2627,6 @@ public class FTP extends Task implements FTPTaskConfig { | |||
| */ | |||
| public long getMilliseconds(int action) { | |||
| String granularityU = getValue().toUpperCase(Locale.ENGLISH); | |||
| if ("".equals(granularityU)) { | |||
| if (action == SEND_FILES) { | |||
| return GRANULARITY_MINUTE; | |||
| @@ -588,9 +588,7 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||
| * synonym for -1. | |||
| */ | |||
| public void setRetriesAllowed(String retriesAllowed) { | |||
| String r = retriesAllowed != null | |||
| ? retriesAllowed.toUpperCase(Locale.ENGLISH) : null; | |||
| if ("FOREVER".equals(r)) { | |||
| if ("FOREVER".equalsIgnoreCase(retriesAllowed)) { | |||
| this.retriesAllowed = Retryable.RETRY_FOREVER; | |||
| } else { | |||
| try { | |||
| @@ -865,7 +863,6 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||
| */ | |||
| public int getAction() { | |||
| String actionL = getValue().toLowerCase(Locale.ENGLISH); | |||
| if (actionL.equals("send") || actionL.equals("put")) { | |||
| return SEND_FILES; | |||
| } else if (actionL.equals("recv") || actionL.equals("get")) { | |||
| @@ -924,7 +921,6 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||
| */ | |||
| public long getMilliseconds(int action) { | |||
| String granularityU = getValue().toUpperCase(Locale.ENGLISH); | |||
| if ("".equals(granularityU)) { | |||
| if (action == SEND_FILES) { | |||
| return GRANULARITY_MINUTE; | |||
| @@ -27,7 +27,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import java.io.File; | |||
| import java.util.Vector; | |||
| import java.util.ArrayList; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.BuildException; | |||
| @@ -84,12 +83,11 @@ public class P4Fstat extends P4Base { | |||
| * @param filter should be one of all|existing|non-existing. | |||
| */ | |||
| public void setShowFilter(String filter) { | |||
| filter = filter.toLowerCase(Locale.ENGLISH); | |||
| if (filter.equals("all")) { | |||
| if (filter.equalsIgnoreCase("all")) { | |||
| show = SHOW_ALL; | |||
| } else if (filter.equals("existing")) { | |||
| } else if (filter.equalsIgnoreCase("existing")) { | |||
| show = SHOW_EXISTING; | |||
| } else if (filter.equals("non-existing")) { | |||
| } else if (filter.equalsIgnoreCase("non-existing")) { | |||
| show = SHOW_NON_EXISTING; | |||
| } else { | |||
| throw new BuildException("P4Fstat: ShowFilter should be one of: " | |||
| @@ -25,7 +25,6 @@ package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.util.StringUtils; | |||
| @@ -96,7 +95,7 @@ public class P4Label extends P4Base { | |||
| desc = "AntLabel"; | |||
| } | |||
| if (lock != null && !lock.toLowerCase(Locale.ENGLISH).equals("locked")) { | |||
| if (lock != null && !lock.equalsIgnoreCase("locked")) { | |||
| log("lock attribute invalid - ignoring", Project.MSG_WARN); | |||
| } | |||
| @@ -137,7 +136,7 @@ public class P4Label extends P4Base { | |||
| Project.MSG_INFO); | |||
| //Now lock if required | |||
| if (lock != null && lock.toLowerCase(Locale.ENGLISH).equals("locked")) { | |||
| if (lock != null && lock.equalsIgnoreCase("locked")) { | |||
| log("Modifying lock status to 'locked'", Project.MSG_INFO); | |||
| @@ -28,7 +28,6 @@ import java.io.IOException; | |||
| import java.text.MessageFormat; | |||
| import java.text.ParseException; | |||
| import java.util.Enumeration; | |||
| import java.util.Locale; | |||
| import java.util.Random; | |||
| import java.util.Vector; | |||
| import org.apache.tools.ant.BuildException; | |||
| @@ -522,7 +521,7 @@ public class Pvcs extends org.apache.tools.ant.Task { | |||
| * @param f String (yes/no) | |||
| */ | |||
| public void setForce(String f) { | |||
| if (f != null && f.toLowerCase(Locale.ENGLISH).equals("yes")) { | |||
| if (f != null && f.equalsIgnoreCase("yes")) { | |||
| force = "yes"; | |||
| } else { | |||
| force = "no"; | |||
| @@ -26,7 +26,6 @@ import java.text.ParseException; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.GregorianCalendar; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| @@ -517,10 +516,9 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||
| if (autoResponse == null) { | |||
| return FLAG_AUTORESPONSE_DEF; | |||
| } | |||
| autoResponse = autoResponse.toUpperCase(Locale.ENGLISH); | |||
| if (autoResponse.equals("Y")) { | |||
| if (autoResponse.equalsIgnoreCase("Y")) { | |||
| return FLAG_AUTORESPONSE_YES; | |||
| } else if (autoResponse.equals("N")) { | |||
| } else if (autoResponse.equalsIgnoreCase("N")) { | |||
| return FLAG_AUTORESPONSE_NO; | |||
| } else { | |||
| return FLAG_AUTORESPONSE_DEF; | |||
| @@ -23,9 +23,6 @@ import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.types.Path; | |||
| import org.apache.tools.ant.util.ClasspathUtils; | |||
| import java.util.Locale; | |||
| /** | |||
| * Creates the necessary rmic adapter, given basic criteria. | |||
| * | |||
| @@ -96,27 +93,24 @@ public final class RmicAdapterFactory { | |||
| public static RmicAdapter getRmic(String rmicType, Task task, | |||
| Path classpath) | |||
| throws BuildException { | |||
| //convert to lower case in the English locale, | |||
| String compiler = rmicType.toLowerCase(Locale.ENGLISH); | |||
| //handle default specially by choosing the sun or kaffe compiler | |||
| if (DEFAULT_COMPILER.equals(compiler) || compiler.length() == 0) { | |||
| compiler = KaffeRmic.isAvailable() | |||
| if (DEFAULT_COMPILER.equalsIgnoreCase(rmicType) || rmicType.length() == 0) { | |||
| rmicType = KaffeRmic.isAvailable() | |||
| ? KaffeRmic.COMPILER_NAME | |||
| : SunRmic.COMPILER_NAME; | |||
| } | |||
| if (SunRmic.COMPILER_NAME.equals(compiler)) { | |||
| if (SunRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) { | |||
| return new SunRmic(); | |||
| } else if (KaffeRmic.COMPILER_NAME.equals(compiler)) { | |||
| } else if (KaffeRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) { | |||
| return new KaffeRmic(); | |||
| } else if (WLRmic.COMPILER_NAME.equals(compiler)) { | |||
| } else if (WLRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) { | |||
| return new WLRmic(); | |||
| } else if (ForkingSunRmic.COMPILER_NAME.equals(compiler)) { | |||
| } else if (ForkingSunRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) { | |||
| return new ForkingSunRmic(); | |||
| } else if (XNewRmic.COMPILER_NAME.equals(compiler)) { | |||
| } else if (XNewRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) { | |||
| return new XNewRmic(); | |||
| } | |||
| //no match? ask for the non-lower-cased type | |||
| //no match? | |||
| return resolveClassName(rmicType, | |||
| // Memory leak in line below | |||
| task.getProject().createClassLoader(classpath)); | |||
| @@ -18,7 +18,6 @@ | |||
| package org.apache.tools.ant.types; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| /** | |||
| @@ -151,12 +150,4 @@ public abstract class EnumeratedAttribute { | |||
| return getValue(); | |||
| } | |||
| protected static boolean equalsIgnoreCase(String expected, String actual) { | |||
| if (expected == null) { | |||
| return actual == null; | |||
| } | |||
| return actual != null && expected.length() == actual.length() | |||
| && expected.toLowerCase(Locale.ENGLISH) | |||
| .equals(actual.toLowerCase(Locale.ENGLISH)); | |||
| } | |||
| } | |||
| @@ -22,7 +22,6 @@ import java.awt.BasicStroke; | |||
| import java.awt.Graphics2D; | |||
| import java.awt.geom.Arc2D; | |||
| import java.awt.image.BufferedImage; | |||
| import java.util.Locale; | |||
| /** | |||
| * Draw an arc. | |||
| @@ -74,12 +73,11 @@ public class Arc extends BasicShape implements DrawOperation { | |||
| * @todo refactor using an EnumeratedAttribute | |||
| */ | |||
| public void setType(String strType) { | |||
| String stype = strType.toLowerCase(Locale.ENGLISH); | |||
| if (stype.equals("open")) { | |||
| if (strType.equalsIgnoreCase("open")) { | |||
| type = Arc2D.OPEN; | |||
| } else if (stype.equals("pie")) { | |||
| } else if (strType.equalsIgnoreCase("pie")) { | |||
| type = Arc2D.PIE; | |||
| } else if (stype.equals("chord")) { | |||
| } else if (strType.equalsIgnoreCase("chord")) { | |||
| type = Arc2D.CHORD; | |||
| } | |||
| } | |||
| @@ -18,7 +18,6 @@ | |||
| package org.apache.tools.ant.types.optional.image; | |||
| import java.awt.Color; | |||
| import java.util.Locale; | |||
| /** | |||
| * | |||
| @@ -70,33 +69,31 @@ public final class ColorMapper { | |||
| * @todo refactor to use an EnumeratedAttribute (maybe?) | |||
| */ | |||
| public static Color getColorByName(String colorName) { | |||
| colorName = colorName.toLowerCase(Locale.ENGLISH); | |||
| if (colorName.equals(COLOR_BLACK)) { | |||
| if (colorName.equalsIgnoreCase(COLOR_BLACK)) { | |||
| return Color.black; | |||
| } else if (colorName.equals(COLOR_BLUE)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_BLUE)) { | |||
| return Color.blue; | |||
| } else if (colorName.equals(COLOR_CYAN)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_CYAN)) { | |||
| return Color.cyan; | |||
| } else if (colorName.equals(COLOR_DARKGRAY) || colorName.equals(COLOR_DARKGREY)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_DARKGRAY) || colorName.equalsIgnoreCase(COLOR_DARKGREY)) { | |||
| return Color.darkGray; | |||
| } else if (colorName.equals(COLOR_GRAY) || colorName.equals(COLOR_GREY)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_GRAY) || colorName.equalsIgnoreCase(COLOR_GREY)) { | |||
| return Color.gray; | |||
| } else if (colorName.equals(COLOR_LIGHTGRAY) || colorName.equals(COLOR_LIGHTGREY)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_LIGHTGRAY) || colorName.equalsIgnoreCase(COLOR_LIGHTGREY)) { | |||
| return Color.lightGray; | |||
| } else if (colorName.equals(COLOR_GREEN)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_GREEN)) { | |||
| return Color.green; | |||
| } else if (colorName.equals(COLOR_MAGENTA)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_MAGENTA)) { | |||
| return Color.magenta; | |||
| } else if (colorName.equals(COLOR_ORANGE)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_ORANGE)) { | |||
| return Color.orange; | |||
| } else if (colorName.equals(COLOR_PINK)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_PINK)) { | |||
| return Color.pink; | |||
| } else if (colorName.equals(COLOR_RED)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_RED)) { | |||
| return Color.red; | |||
| } else if (colorName.equals(COLOR_WHITE)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_WHITE)) { | |||
| return Color.white; | |||
| } else if (colorName.equals(COLOR_YELLOW)) { | |||
| } else if (colorName.equalsIgnoreCase(COLOR_YELLOW)) { | |||
| return Color.yellow; | |||
| } | |||
| return Color.black; | |||
| @@ -22,7 +22,6 @@ import java.io.BufferedReader; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.io.InputStreamReader; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.types.Parameter; | |||
| @@ -83,9 +82,7 @@ public class ContainsRegexpSelector extends BaseExtendSelector | |||
| if (parameters != null) { | |||
| for (int i = 0; i < parameters.length; i++) { | |||
| String paramname = parameters[i].getName(); | |||
| if (paramname != null | |||
| && EXPRESSION_KEY.equals(paramname | |||
| .toLowerCase(Locale.ENGLISH))) { | |||
| if (EXPRESSION_KEY.equalsIgnoreCase(paramname)) { | |||
| setExpression(parameters[i].getValue()); | |||
| } else { | |||
| setError("Invalid parameter " + paramname); | |||
| @@ -22,7 +22,6 @@ import java.io.BufferedReader; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.io.InputStreamReader; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| @@ -113,15 +112,12 @@ public class ContainsSelector extends BaseExtendSelector implements ResourceSele | |||
| if (parameters != null) { | |||
| for (int i = 0; i < parameters.length; i++) { | |||
| String paramname = parameters[i].getName(); | |||
| if (paramname != null) { | |||
| paramname = paramname.toLowerCase(Locale.ENGLISH); | |||
| } | |||
| if (CONTAINS_KEY.equals(paramname)) { | |||
| if (CONTAINS_KEY.equalsIgnoreCase(paramname)) { | |||
| setText(parameters[i].getValue()); | |||
| } else if (CASE_KEY.equals(paramname)) { | |||
| } else if (CASE_KEY.equalsIgnoreCase(paramname)) { | |||
| setCasesensitive(Project.toBoolean( | |||
| parameters[i].getValue())); | |||
| } else if (WHITESPACE_KEY.equals(paramname)) { | |||
| } else if (WHITESPACE_KEY.equalsIgnoreCase(paramname)) { | |||
| setIgnorewhitespace(Project.toBoolean( | |||
| parameters[i].getValue())); | |||
| } else { | |||
| @@ -171,30 +171,27 @@ public class DateSelector extends BaseExtendSelector { | |||
| if (parameters != null) { | |||
| for (int i = 0; i < parameters.length; i++) { | |||
| String paramname = parameters[i].getName(); | |||
| if (paramname != null) { | |||
| paramname = paramname.toLowerCase(Locale.ENGLISH); | |||
| } | |||
| if (MILLIS_KEY.equals(paramname)) { | |||
| if (MILLIS_KEY.equalsIgnoreCase(paramname)) { | |||
| try { | |||
| setMillis(Long.parseLong(parameters[i].getValue())); | |||
| } catch (NumberFormatException nfe) { | |||
| setError("Invalid millisecond setting " | |||
| + parameters[i].getValue()); | |||
| } | |||
| } else if (DATETIME_KEY.equals(paramname)) { | |||
| } else if (DATETIME_KEY.equalsIgnoreCase(paramname)) { | |||
| setDatetime(parameters[i].getValue()); | |||
| } else if (CHECKDIRS_KEY.equals(paramname)) { | |||
| } else if (CHECKDIRS_KEY.equalsIgnoreCase(paramname)) { | |||
| setCheckdirs(Project.toBoolean(parameters[i].getValue())); | |||
| } else if (GRANULARITY_KEY.equals(paramname)) { | |||
| } else if (GRANULARITY_KEY.equalsIgnoreCase(paramname)) { | |||
| try { | |||
| setGranularity(Integer.parseInt(parameters[i].getValue())); | |||
| } catch (NumberFormatException nfe) { | |||
| setError("Invalid granularity setting " | |||
| + parameters[i].getValue()); | |||
| } | |||
| } else if (WHEN_KEY.equals(paramname)) { | |||
| } else if (WHEN_KEY.equalsIgnoreCase(paramname)) { | |||
| setWhen(new TimeComparison(parameters[i].getValue())); | |||
| } else if (PATTERN_KEY.equals(paramname)) { | |||
| } else if (PATTERN_KEY.equalsIgnoreCase(paramname)) { | |||
| setPattern(parameters[i].getValue()); | |||
| } else { | |||
| setError("Invalid parameter " + paramname); | |||
| @@ -19,7 +19,6 @@ | |||
| package org.apache.tools.ant.types.selectors; | |||
| import java.io.File; | |||
| import java.util.Locale; | |||
| import java.util.StringTokenizer; | |||
| import org.apache.tools.ant.BuildException; | |||
| @@ -95,17 +94,14 @@ public class DepthSelector extends BaseExtendSelector { | |||
| if (parameters != null) { | |||
| for (int i = 0; i < parameters.length; i++) { | |||
| String paramname = parameters[i].getName(); | |||
| if (paramname != null) { | |||
| paramname = paramname.toLowerCase(Locale.ENGLISH); | |||
| } | |||
| if (MIN_KEY.equals(paramname)) { | |||
| if (MIN_KEY.equalsIgnoreCase(paramname)) { | |||
| try { | |||
| setMin(Integer.parseInt(parameters[i].getValue())); | |||
| } catch (NumberFormatException nfe1) { | |||
| setError("Invalid minimum value " | |||
| + parameters[i].getValue()); | |||
| } | |||
| } else if (MAX_KEY.equals(paramname)) { | |||
| } else if (MAX_KEY.equalsIgnoreCase(paramname)) { | |||
| try { | |||
| setMax(Integer.parseInt(parameters[i].getValue())); | |||
| } catch (NumberFormatException nfe1) { | |||
| @@ -19,7 +19,6 @@ | |||
| package org.apache.tools.ant.types.selectors; | |||
| import java.io.File; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.types.Parameter; | |||
| @@ -134,17 +133,14 @@ public class FilenameSelector extends BaseExtendSelector { | |||
| if (parameters != null) { | |||
| for (int i = 0; i < parameters.length; i++) { | |||
| String paramname = parameters[i].getName(); | |||
| if (paramname != null) { | |||
| paramname = paramname.toLowerCase(Locale.ENGLISH); | |||
| } | |||
| if (NAME_KEY.equals(paramname)) { | |||
| if (NAME_KEY.equalsIgnoreCase(paramname)) { | |||
| setName(parameters[i].getValue()); | |||
| } else if (CASE_KEY.equals(paramname)) { | |||
| } else if (CASE_KEY.equalsIgnoreCase(paramname)) { | |||
| setCasesensitive(Project.toBoolean( | |||
| parameters[i].getValue())); | |||
| } else if (NEGATE_KEY.equals(paramname)) { | |||
| } else if (NEGATE_KEY.equalsIgnoreCase(paramname)) { | |||
| setNegate(Project.toBoolean(parameters[i].getValue())); | |||
| } else if (REGEX_KEY.equals(paramname)) { | |||
| } else if (REGEX_KEY.equalsIgnoreCase(paramname)) { | |||
| setRegex(parameters[i].getValue()); | |||
| } else { | |||
| setError("Invalid parameter " + paramname); | |||
| @@ -19,7 +19,6 @@ | |||
| package org.apache.tools.ant.types.selectors; | |||
| import java.io.File; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.types.Comparison; | |||
| import org.apache.tools.ant.types.EnumeratedAttribute; | |||
| @@ -170,21 +169,18 @@ public class SizeSelector extends BaseExtendSelector { | |||
| if (parameters != null) { | |||
| for (int i = 0; i < parameters.length; i++) { | |||
| String paramname = parameters[i].getName(); | |||
| if (paramname != null) { | |||
| paramname = paramname.toLowerCase(Locale.ENGLISH); | |||
| } | |||
| if (SIZE_KEY.equals(paramname)) { | |||
| if (SIZE_KEY.equalsIgnoreCase(paramname)) { | |||
| try { | |||
| setValue(Long.parseLong(parameters[i].getValue())); | |||
| } catch (NumberFormatException nfe) { | |||
| setError("Invalid size setting " | |||
| + parameters[i].getValue()); | |||
| } | |||
| } else if (UNITS_KEY.equals(paramname)) { | |||
| } else if (UNITS_KEY.equalsIgnoreCase(paramname)) { | |||
| ByteUnits units = new ByteUnits(); | |||
| units.setValue(parameters[i].getValue()); | |||
| setUnits(units); | |||
| } else if (WHEN_KEY.equals(paramname)) { | |||
| } else if (WHEN_KEY.equalsIgnoreCase(paramname)) { | |||
| SizeComparisons scmp = new SizeComparisons(); | |||
| scmp.setValue(parameters[i].getValue()); | |||
| setWhen(scmp); | |||
| @@ -19,7 +19,6 @@ | |||
| package org.apache.tools.ant.types.selectors; | |||
| import java.io.File; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.types.EnumeratedAttribute; | |||
| import org.apache.tools.ant.types.Parameter; | |||
| @@ -72,10 +71,7 @@ public class TypeSelector extends BaseExtendSelector { | |||
| if (parameters != null) { | |||
| for (int i = 0; i < parameters.length; i++) { | |||
| String paramname = parameters[i].getName(); | |||
| if (paramname != null) { | |||
| paramname = paramname.toLowerCase(Locale.ENGLISH); | |||
| } | |||
| if (TYPE_KEY.equals(paramname)) { | |||
| if (TYPE_KEY.equalsIgnoreCase(paramname)) { | |||
| FileType t = new FileType(); | |||
| t.setValue(parameters[i].getValue()); | |||
| setType(t); | |||
| @@ -23,7 +23,6 @@ package org.apache.tools.ant.types.selectors.modifiedselector; | |||
| import java.io.File; | |||
| import java.util.Comparator; | |||
| import java.util.Iterator; | |||
| import java.util.Locale; | |||
| import java.util.Vector; | |||
| // Ant | |||
| @@ -721,8 +720,6 @@ public class ModifiedSelector extends BaseExtendSelector | |||
| public void useParameter(Parameter parameter) { | |||
| String key = parameter.getName(); | |||
| String value = parameter.getValue(); | |||
| String valueLC = | |||
| value != null ? value.toLowerCase(Locale.ENGLISH) : null; | |||
| if ("cache".equals(key)) { | |||
| CacheName cn = new CacheName(); | |||
| cn.setValue(value); | |||
| @@ -737,19 +734,19 @@ public class ModifiedSelector extends BaseExtendSelector | |||
| setComparator(cn); | |||
| } else if ("update".equals(key)) { | |||
| boolean updateValue = | |||
| ("true".equals(valueLC)) | |||
| ("true".equalsIgnoreCase(value)) | |||
| ? true | |||
| : false; | |||
| setUpdate(updateValue); | |||
| } else if ("delayupdate".equals(key)) { | |||
| boolean updateValue = | |||
| ("true".equals(valueLC)) | |||
| ("true".equalsIgnoreCase(value)) | |||
| ? true | |||
| : false; | |||
| setDelayUpdate(updateValue); | |||
| } else if ("seldirs".equals(key)) { | |||
| boolean sdValue = | |||
| ("true".equals(valueLC)) | |||
| ("true".equalsIgnoreCase(value)) | |||
| ? true | |||
| : false; | |||
| setSeldirs(sdValue); | |||
| @@ -21,7 +21,6 @@ package org.apache.tools.ant.util; | |||
| import java.io.IOException; | |||
| import java.io.PipedInputStream; | |||
| import java.io.PipedOutputStream; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.ProjectComponent; | |||
| import org.apache.tools.ant.Task; | |||
| @@ -88,17 +87,14 @@ public class LeadPipeInputStream extends PipedInputStream { | |||
| result = super.read(); | |||
| } catch (IOException eyeOhEx) { | |||
| String msg = eyeOhEx.getMessage(); | |||
| if (msg != null) { | |||
| msg = msg.toLowerCase(Locale.ENGLISH); | |||
| } | |||
| if ("write end dead".equals(msg)) { | |||
| if ("write end dead".equalsIgnoreCase(msg)) { | |||
| if (super.in > 0 && super.out < super.buffer.length | |||
| && super.out > super.in) { | |||
| result = super.buffer[super.out++] & BYTE_MASK; | |||
| } | |||
| } else { | |||
| log("error at LeadPipeInputStream.read(): " | |||
| + eyeOhEx.getMessage(), Project.MSG_INFO); | |||
| log("error at LeadPipeInputStream.read(): " + msg, | |||
| Project.MSG_INFO); | |||
| } | |||
| } | |||
| return result; | |||
| @@ -21,7 +21,6 @@ package org.apache.tools.ant.util.optional; | |||
| import org.apache.tools.ant.BuildException; | |||
| import java.util.Iterator; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.util.ScriptRunnerBase; | |||
| import org.apache.tools.ant.util.ReflectUtil; | |||
| import org.apache.tools.ant.util.ReflectWrapper; | |||
| @@ -90,7 +89,7 @@ public class JavaxScriptRunner extends ScriptRunnerBase { | |||
| for (Iterator i = getBeans().keySet().iterator(); i.hasNext();) { | |||
| String key = (String) i.next(); | |||
| Object value = getBeans().get(key); | |||
| if ("FX".equals(getLanguage().toUpperCase(Locale.ENGLISH))) { | |||
| if ("FX".equalsIgnoreCase(getLanguage())) { | |||
| engine.invoke( | |||
| "put", String.class, key | |||
| + ":" + value.getClass().getName(), | |||
| @@ -191,15 +191,10 @@ abstract class ZipEncodingHelper { | |||
| */ | |||
| static final String UTF8 = "UTF8"; | |||
| /** | |||
| * name of the encoding UTF-8 used for comparisions. | |||
| */ | |||
| private static final String UTF8_LC = UTF8.toLowerCase(Locale.ENGLISH); | |||
| /** | |||
| * variant name of the encoding UTF-8 used for comparisions. | |||
| */ | |||
| private static final String UTF_DASH_8_LC = "utf-8"; | |||
| private static final String UTF_DASH_8 = "utf-8"; | |||
| /** | |||
| * name of the encoding UTF-8 | |||
| @@ -250,7 +245,7 @@ abstract class ZipEncodingHelper { | |||
| // check platform's default encoding | |||
| encoding = System.getProperty("file.encoding"); | |||
| } | |||
| String enc = encoding.toLowerCase(Locale.ENGLISH); | |||
| return UTF8_LC.equals(enc) || UTF_DASH_8_LC.equals(enc); | |||
| return UTF8.equalsIgnoreCase(encoding) | |||
| || UTF_DASH_8.equalsIgnoreCase(encoding); | |||
| } | |||
| } | |||
| @@ -18,6 +18,7 @@ | |||
| package org.apache.tools.ant.types.selectors; | |||
| import java.util.Locale; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.types.Parameter; | |||
| @@ -198,4 +199,45 @@ public class SizeSelectorTest extends BaseSelectorTest { | |||
| } | |||
| public void testParameterParsingLowerCase() { | |||
| testCaseInsensitiveParameterParsing("units"); | |||
| } | |||
| public void testParameterParsingUpperCase() { | |||
| testCaseInsensitiveParameterParsing("UNITS"); | |||
| } | |||
| public void testParameterParsingLowerCaseTurkish() { | |||
| Locale l = Locale.getDefault(); | |||
| try { | |||
| Locale.setDefault(new Locale("tr")); | |||
| testCaseInsensitiveParameterParsing("units"); | |||
| } finally { | |||
| Locale.setDefault(l); | |||
| } | |||
| } | |||
| public void testParameterParsingUpperCaseTurkish() { | |||
| Locale l = Locale.getDefault(); | |||
| try { | |||
| Locale.setDefault(new Locale("tr")); | |||
| testCaseInsensitiveParameterParsing("UNITS"); | |||
| } finally { | |||
| Locale.setDefault(l); | |||
| } | |||
| } | |||
| private void testCaseInsensitiveParameterParsing(String name) { | |||
| SizeSelector s = new SizeSelector(); | |||
| Parameter p = new Parameter(); | |||
| p.setName(name); | |||
| p.setValue("foo"); | |||
| try { | |||
| s.setParameters(new Parameter[] {p}); | |||
| fail("should have caused an exception"); | |||
| } catch (BuildException be) { | |||
| assertEquals("foo is not a legal value for this attribute", | |||
| be.getMessage()); | |||
| } | |||
| } | |||
| } | |||