git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@910955 13f79535-47bb-0310-9956-ffa450edef68master
@@ -378,7 +378,7 @@ public final class IntrospectionHelper { | |||||
public void setAttribute(Project p, Object element, String attributeName, | public void setAttribute(Project p, Object element, String attributeName, | ||||
Object value) throws BuildException { | Object value) throws BuildException { | ||||
AttributeSetter as = (AttributeSetter) attributeSetters.get( | AttributeSetter as = (AttributeSetter) attributeSetters.get( | ||||
attributeName.toLowerCase(Locale.US)); | |||||
attributeName.toLowerCase(Locale.ENGLISH)); | |||||
if (as == null && value != null) { | if (as == null && value != null) { | ||||
if (element instanceof DynamicAttributeNS) { | if (element instanceof DynamicAttributeNS) { | ||||
DynamicAttributeNS dc = (DynamicAttributeNS) element; | DynamicAttributeNS dc = (DynamicAttributeNS) element; | ||||
@@ -391,7 +391,7 @@ public final class IntrospectionHelper { | |||||
} | } | ||||
if (element instanceof DynamicAttribute) { | if (element instanceof DynamicAttribute) { | ||||
DynamicAttribute dc = (DynamicAttribute) element; | DynamicAttribute dc = (DynamicAttribute) element; | ||||
dc.setDynamicAttribute(attributeName.toLowerCase(Locale.US), value.toString()); | |||||
dc.setDynamicAttribute(attributeName.toLowerCase(Locale.ENGLISH), value.toString()); | |||||
return; | return; | ||||
} | } | ||||
if (attributeName.indexOf(':') >= 0) { | if (attributeName.indexOf(':') >= 0) { | ||||
@@ -529,7 +529,7 @@ public final class IntrospectionHelper { | |||||
} | } | ||||
NestedCreator nc = null; | NestedCreator nc = null; | ||||
if (uri.equals(parentUri) || uri.length() == 0) { | if (uri.equals(parentUri) || uri.length() == 0) { | ||||
nc = (NestedCreator) nestedCreators.get(name.toLowerCase(Locale.US)); | |||||
nc = (NestedCreator) nestedCreators.get(name.toLowerCase(Locale.ENGLISH)); | |||||
} | } | ||||
if (nc == null) { | if (nc == null) { | ||||
nc = createAddTypeCreator(project, parent, elementName); | nc = createAddTypeCreator(project, parent, elementName); | ||||
@@ -573,7 +573,7 @@ public final class IntrospectionHelper { | |||||
if (nestedElement == null && parent instanceof DynamicElement) { | if (nestedElement == null && parent instanceof DynamicElement) { | ||||
DynamicElement dc = (DynamicElement) parent; | DynamicElement dc = (DynamicElement) parent; | ||||
nestedElement = | nestedElement = | ||||
dc.createDynamicElement(localName.toLowerCase(Locale.US)); | |||||
dc.createDynamicElement(localName.toLowerCase(Locale.ENGLISH)); | |||||
} | } | ||||
return nestedElement; | return nestedElement; | ||||
} | } | ||||
@@ -740,7 +740,7 @@ public final class IntrospectionHelper { | |||||
public boolean supportsReflectElement( | public boolean supportsReflectElement( | ||||
String parentUri, String elementName) { | String parentUri, String elementName) { | ||||
String name = ProjectHelper.extractNameFromComponentName(elementName); | String name = ProjectHelper.extractNameFromComponentName(elementName); | ||||
if (!nestedCreators.containsKey(name.toLowerCase(Locale.US))) { | |||||
if (!nestedCreators.containsKey(name.toLowerCase(Locale.ENGLISH))) { | |||||
return false; | return false; | ||||
} | } | ||||
String uri = ProjectHelper.extractUriFromComponentName(elementName); | String uri = ProjectHelper.extractUriFromComponentName(elementName); | ||||
@@ -781,7 +781,7 @@ public final class IntrospectionHelper { | |||||
if (elementName == null) { | if (elementName == null) { | ||||
return; | return; | ||||
} | } | ||||
NestedCreator ns = (NestedCreator) nestedCreators.get(elementName.toLowerCase(Locale.US)); | |||||
NestedCreator ns = (NestedCreator) nestedCreators.get(elementName.toLowerCase(Locale.ENGLISH)); | |||||
if (ns == null) { | if (ns == null) { | ||||
return; | return; | ||||
} | } | ||||
@@ -1274,7 +1274,7 @@ public final class IntrospectionHelper { | |||||
* @return the lower-cased method name with the prefix removed. | * @return the lower-cased method name with the prefix removed. | ||||
*/ | */ | ||||
private static String getPropertyName(String methodName, String prefix) { | private static String getPropertyName(String methodName, String prefix) { | ||||
return methodName.substring(prefix.length()).toLowerCase(Locale.US); | |||||
return methodName.substring(prefix.length()).toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -32,6 +32,7 @@ import java.util.Vector; | |||||
import java.util.Set; | import java.util.Set; | ||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Locale; | |||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.WeakHashMap; | import java.util.WeakHashMap; | ||||
import org.apache.tools.ant.input.DefaultInputHandler; | import org.apache.tools.ant.input.DefaultInputHandler; | ||||
@@ -1714,9 +1715,10 @@ public class Project implements ResourceFactory { | |||||
* <code>false</code> otherwise. | * <code>false</code> otherwise. | ||||
*/ | */ | ||||
public static boolean toBoolean(String s) { | public static boolean toBoolean(String s) { | ||||
return ("on".equalsIgnoreCase(s) | |||||
|| "true".equalsIgnoreCase(s) | |||||
|| "yes".equalsIgnoreCase(s)); | |||||
String lc = s == null ? null : s.toLowerCase(Locale.ENGLISH); | |||||
return ("on".equals(lc) | |||||
|| "true".equals(lc) | |||||
|| "yes".equals(lc)); | |||||
} | } | ||||
/** | /** | ||||
@@ -47,6 +47,10 @@ public class ProjectHelper { | |||||
/** Polymorphic attribute */ | /** Polymorphic attribute */ | ||||
public static final String ANT_TYPE = "ant-type"; | public static final String ANT_TYPE = "ant-type"; | ||||
/** Lowercase version of {@link ANT_TYPE} used for comparisions */ | |||||
public static final String ANT_TYPE_LC = | |||||
ANT_TYPE.toLowerCase(Locale.ENGLISH); | |||||
/** | /** | ||||
* Name of JVM system property which provides the name of the | * Name of JVM system property which provides the name of the | ||||
* ProjectHelper class to use. | * ProjectHelper class to use. | ||||
@@ -261,7 +265,7 @@ public class ProjectHelper { | |||||
// reflect these into the target | // reflect these into the target | ||||
String value = replaceProperties(project, attrs.getValue(i), project.getProperties()); | String value = replaceProperties(project, attrs.getValue(i), project.getProperties()); | ||||
try { | try { | ||||
ih.setAttribute(project, target, attrs.getName(i).toLowerCase(Locale.US), value); | |||||
ih.setAttribute(project, target, attrs.getName(i).toLowerCase(Locale.ENGLISH), value); | |||||
} catch (BuildException be) { | } catch (BuildException be) { | ||||
// id attribute must be set externally | // id attribute must be set externally | ||||
if (!attrs.getName(i).equals("id")) { | if (!attrs.getName(i).equals("id")) { | ||||
@@ -24,6 +24,7 @@ import java.util.HashSet; | |||||
import java.util.Hashtable; | import java.util.Hashtable; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Locale; | |||||
import java.util.Set; | import java.util.Set; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
import java.util.Enumeration; | import java.util.Enumeration; | ||||
@@ -1145,13 +1146,13 @@ public class PropertyHelper implements GetProperty { | |||||
return (Boolean) value; | return (Boolean) value; | ||||
} | } | ||||
if (value instanceof String) { | if (value instanceof String) { | ||||
String s = (String) value; | |||||
String s = ((String) value).toLowerCase(Locale.ENGLISH); | |||||
if (Project.toBoolean(s)) { | if (Project.toBoolean(s)) { | ||||
return Boolean.TRUE; | return Boolean.TRUE; | ||||
} | } | ||||
if ("off".equalsIgnoreCase(s) | |||||
|| "false".equalsIgnoreCase(s) | |||||
|| "no".equalsIgnoreCase(s)) { | |||||
if ("off".equals(s) | |||||
|| "false".equals(s) | |||||
|| "no".equals(s)) { | |||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
} | } | ||||
} | } | ||||
@@ -185,14 +185,15 @@ public class RuntimeConfigurable implements Serializable { | |||||
* @param value the attribute's value. | * @param value the attribute's value. | ||||
*/ | */ | ||||
public synchronized void setAttribute(String name, String value) { | public synchronized void setAttribute(String name, String value) { | ||||
if (name.equalsIgnoreCase(ProjectHelper.ANT_TYPE)) { | |||||
String nameLC = name.toLowerCase(Locale.ENGLISH); | |||||
if (nameLC.equals(ProjectHelper.ANT_TYPE_LC)) { | |||||
this.polyType = value; | this.polyType = value; | ||||
} else { | } else { | ||||
if (attributeNames == null) { | if (attributeNames == null) { | ||||
attributeNames = new ArrayList(); | attributeNames = new ArrayList(); | ||||
attributeMap = new HashMap(); | attributeMap = new HashMap(); | ||||
} | } | ||||
if (name.toLowerCase(Locale.US).equals("refid")) { | |||||
if (nameLC.equals("refid")) { | |||||
attributeNames.add(0, name); | attributeNames.add(0, name); | ||||
} else { | } else { | ||||
attributeNames.add(name); | attributeNames.add(name); | ||||
@@ -859,7 +859,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||||
IntrospectionHelper ih = IntrospectionHelper.getHelper(helperImpl.project, parentClass); | IntrospectionHelper ih = IntrospectionHelper.getHelper(helperImpl.project, parentClass); | ||||
try { | try { | ||||
String elementName = propType.toLowerCase(Locale.US); | |||||
String elementName = propType.toLowerCase(Locale.ENGLISH); | |||||
if (parent instanceof UnknownElement) { | if (parent instanceof UnknownElement) { | ||||
UnknownElement uc = new UnknownElement(elementName); | UnknownElement uc = new UnknownElement(elementName); | ||||
uc.setProject(helperImpl.project); | uc.setProject(helperImpl.project); | ||||
@@ -18,7 +18,6 @@ | |||||
package org.apache.tools.ant.launch; | package org.apache.tools.ant.launch; | ||||
import java.net.MalformedURLException; | import java.net.MalformedURLException; | ||||
import java.net.URL; | import java.net.URL; | ||||
import java.io.File; | import java.io.File; | ||||
import java.io.FilenameFilter; | import java.io.FilenameFilter; | ||||
@@ -442,7 +441,7 @@ public final class Locator { | |||||
// Found in java.home as given | // Found in java.home as given | ||||
return toolsJar; | return toolsJar; | ||||
} | } | ||||
if (javaHome.toLowerCase(Locale.US).endsWith(File.separator + "jre")) { | |||||
if (javaHome.toLowerCase(Locale.ENGLISH).endsWith(File.separator + "jre")) { | |||||
javaHome = javaHome.substring( | javaHome = javaHome.substring( | ||||
0, javaHome.length() - "/jre".length()); | 0, javaHome.length() - "/jre".length()); | ||||
toolsJar = new File(javaHome + libToolsJar); | toolsJar = new File(javaHome + libToolsJar); | ||||
@@ -498,7 +497,7 @@ public final class Locator { | |||||
if (!location.isDirectory()) { | if (!location.isDirectory()) { | ||||
urls = new URL[1]; | urls = new URL[1]; | ||||
String path = location.getPath(); | String path = location.getPath(); | ||||
String littlePath = path.toLowerCase(Locale.US); | |||||
String littlePath = path.toLowerCase(Locale.ENGLISH); | |||||
for (int i = 0; i < extensions.length; ++i) { | for (int i = 0; i < extensions.length; ++i) { | ||||
if (littlePath.endsWith(extensions[i])) { | if (littlePath.endsWith(extensions[i])) { | ||||
urls[0] = fileToURL(location); | urls[0] = fileToURL(location); | ||||
@@ -510,7 +509,7 @@ public final class Locator { | |||||
File[] matches = location.listFiles( | File[] matches = location.listFiles( | ||||
new FilenameFilter() { | new FilenameFilter() { | ||||
public boolean accept(File dir, String name) { | public boolean accept(File dir, String name) { | ||||
String littleName = name.toLowerCase(Locale.US); | |||||
String littleName = name.toLowerCase(Locale.ENGLISH); | |||||
for (int i = 0; i < extensions.length; ++i) { | for (int i = 0; i < extensions.length; ++i) { | ||||
if (littleName.endsWith(extensions[i])) { | if (littleName.endsWith(extensions[i])) { | ||||
return true; | return true; | ||||
@@ -501,7 +501,7 @@ public class Available extends Task implements Condition { | |||||
* @return true if the value specifies a directory. | * @return true if the value specifies a directory. | ||||
*/ | */ | ||||
public boolean isDir() { | public boolean isDir() { | ||||
return "dir".equalsIgnoreCase(getValue()); | |||||
return equalsIgnoreCase("dir", getValue()); | |||||
} | } | ||||
/** | /** | ||||
@@ -510,7 +510,7 @@ public class Available extends Task implements Condition { | |||||
* @return true if the value specifies a file. | * @return true if the value specifies a file. | ||||
*/ | */ | ||||
public boolean isFile() { | public boolean isFile() { | ||||
return "file".equalsIgnoreCase(getValue()); | |||||
return equalsIgnoreCase("file", getValue()); | |||||
} | } | ||||
} | } | ||||
@@ -271,7 +271,7 @@ public abstract class Definer extends DefBase { | |||||
URL url = (URL) urls.nextElement(); | URL url = (URL) urls.nextElement(); | ||||
int fmt = this.format; | int fmt = this.format; | ||||
if (url.toString().toLowerCase(Locale.US).endsWith(".xml")) { | |||||
if (url.toString().toLowerCase(Locale.ENGLISH).endsWith(".xml")) { | |||||
fmt = Format.XML; | fmt = Format.XML; | ||||
} | } | ||||
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.OutputStream; | import java.io.OutputStream; | ||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
@@ -105,6 +106,8 @@ public class EchoXML extends XMLFragment { | |||||
public static class NamespacePolicy extends EnumeratedAttribute { | public static class NamespacePolicy extends EnumeratedAttribute { | ||||
private static final String IGNORE = "ignore"; | private static final String IGNORE = "ignore"; | ||||
private static final String ELEMENTS = "elementsOnly"; | private static final String ELEMENTS = "elementsOnly"; | ||||
private static final String ELEMENTS_LC = | |||||
ELEMENTS.toLowerCase(Locale.ENGLISH); | |||||
private static final String ALL = "all"; | private static final String ALL = "all"; | ||||
public static final NamespacePolicy DEFAULT | public static final NamespacePolicy DEFAULT | ||||
@@ -121,13 +124,14 @@ public class EchoXML extends XMLFragment { | |||||
} | } | ||||
public DOMElementWriter.XmlNamespacePolicy getPolicy() { | public DOMElementWriter.XmlNamespacePolicy getPolicy() { | ||||
String s = getValue(); | |||||
if (IGNORE.equalsIgnoreCase(s)) { | |||||
String v = getValue(); | |||||
String s = v != null ? v.toLowerCase(Locale.ENGLISH) : null; | |||||
if (IGNORE.equals(s)) { | |||||
return DOMElementWriter.XmlNamespacePolicy.IGNORE; | return DOMElementWriter.XmlNamespacePolicy.IGNORE; | ||||
} else if (ELEMENTS.equalsIgnoreCase(s)) { | |||||
} else if (ELEMENTS_LC.equals(s)) { | |||||
return | return | ||||
DOMElementWriter.XmlNamespacePolicy.ONLY_QUALIFY_ELEMENTS; | DOMElementWriter.XmlNamespacePolicy.ONLY_QUALIFY_ELEMENTS; | ||||
} else if (ALL.equalsIgnoreCase(s)) { | |||||
} else if (ALL.equals(s)) { | |||||
return DOMElementWriter.XmlNamespacePolicy.QUALIFY_ALL; | return DOMElementWriter.XmlNamespacePolicy.QUALIFY_ALL; | ||||
} else { | } else { | ||||
throw new BuildException("Invalid namespace policy: " + s); | throw new BuildException("Invalid namespace policy: " + s); | ||||
@@ -25,6 +25,7 @@ import java.io.IOException; | |||||
import java.io.InputStream; | import java.io.InputStream; | ||||
import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||
import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | import org.apache.tools.ant.MagicNames; | ||||
@@ -97,9 +98,9 @@ public class Exec extends Task { | |||||
dir = getProject().getBaseDir(); | dir = getProject().getBaseDir(); | ||||
} | } | ||||
if (myos.toLowerCase().indexOf("windows") >= 0) { | |||||
if (myos.toLowerCase(Locale.ENGLISH).indexOf("windows") >= 0) { | |||||
if (!dir.equals(getProject().resolveFile("."))) { | if (!dir.equals(getProject().resolveFile("."))) { | ||||
if (myos.toLowerCase().indexOf("nt") >= 0) { | |||||
if (myos.toLowerCase(Locale.ENGLISH).indexOf("nt") >= 0) { | |||||
command = "cmd /c cd " + dir + " && " + command; | command = "cmd /c cd " + dir + " && " + command; | ||||
} else { | } else { | ||||
String ant = getProject().getProperty(MagicNames.ANT_HOME); | String ant = getProject().getProperty(MagicNames.ANT_HOME); | ||||
@@ -401,7 +401,7 @@ public class ExecTask extends Task { | |||||
* @param osFamily the family to restrict to. | * @param osFamily the family to restrict to. | ||||
*/ | */ | ||||
public void setOsFamily(String osFamily) { | public void setOsFamily(String osFamily) { | ||||
this.osFamily = osFamily.toLowerCase(Locale.US); | |||||
this.osFamily = osFamily.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -37,6 +37,7 @@ import java.util.Enumeration; | |||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Locale; | |||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import java.util.TreeMap; | import java.util.TreeMap; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
@@ -341,7 +342,7 @@ public class Jar extends Zip { | |||||
Enumeration e = zf.entries(); | Enumeration e = zf.entries(); | ||||
while (e.hasMoreElements()) { | while (e.hasMoreElements()) { | ||||
ZipEntry ze = (ZipEntry) e.nextElement(); | ZipEntry ze = (ZipEntry) e.nextElement(); | ||||
if (ze.getName().equalsIgnoreCase(MANIFEST_NAME)) { | |||||
if (ze.getName().toUpperCase(Locale.ENGLISH).equals(MANIFEST_NAME)) { | |||||
InputStreamReader isr = | InputStreamReader isr = | ||||
new InputStreamReader(zf.getInputStream(ze), "UTF-8"); | new InputStreamReader(zf.getInputStream(ze), "UTF-8"); | ||||
return getManifest(isr); | return getManifest(isr); | ||||
@@ -382,7 +383,7 @@ public class Jar extends Zip { | |||||
Enumeration e = zf.entries(); | Enumeration e = zf.entries(); | ||||
while (e.hasMoreElements()) { | while (e.hasMoreElements()) { | ||||
ZipEntry ze = (ZipEntry) e.nextElement(); | ZipEntry ze = (ZipEntry) e.nextElement(); | ||||
if (ze.getName().equalsIgnoreCase(INDEX_NAME)) { | |||||
if (ze.getName().toUpperCase(Locale.ENGLISH).equals(INDEX_NAME)) { | |||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
@@ -692,11 +693,12 @@ public class Jar extends Zip { | |||||
protected void zipFile(InputStream is, ZipOutputStream zOut, String vPath, | protected void zipFile(InputStream is, ZipOutputStream zOut, String vPath, | ||||
long lastModified, File fromArchive, int mode) | long lastModified, File fromArchive, int mode) | ||||
throws IOException { | throws IOException { | ||||
if (MANIFEST_NAME.equalsIgnoreCase(vPath)) { | |||||
String vPathUC = vPath != null ? vPath.toUpperCase(Locale.ENGLISH) : null; | |||||
if (MANIFEST_NAME.equals(vPathUC)) { | |||||
if (isFirstPass()) { | if (isFirstPass()) { | ||||
filesetManifest(fromArchive, is); | filesetManifest(fromArchive, is); | ||||
} | } | ||||
} else if (INDEX_NAME.equalsIgnoreCase(vPath) && index) { | |||||
} else if (INDEX_NAME.equals(vPathUC) && index) { | |||||
logWhenWriting("Warning: selected " + archiveType | logWhenWriting("Warning: selected " + archiveType | ||||
+ " files include a " + INDEX_NAME + " which will" | + " files include a " + INDEX_NAME + " which will" | ||||
+ " be replaced by a newly generated one.", | + " be replaced by a newly generated one.", | ||||
@@ -965,7 +967,7 @@ public class Jar extends Zip { | |||||
message.append(br); | message.append(br); | ||||
message.append("Location: ").append(getLocation()); | message.append("Location: ").append(getLocation()); | ||||
message.append(br); | message.append(br); | ||||
if (strict.getValue().equalsIgnoreCase("fail")) { | |||||
if (strict.getValue().toLowerCase(Locale.ENGLISH).equals("fail")) { | |||||
throw new BuildException(message.toString(), getLocation()); | throw new BuildException(message.toString(), getLocation()); | ||||
} else { | } else { | ||||
logWhenWriting(message.toString(), strict.getLogLevel()); | logWhenWriting(message.toString(), strict.getLogLevel()); | ||||
@@ -1167,7 +1169,8 @@ public class Jar extends Zip { | |||||
}); | }); | ||||
} | } | ||||
for (int j = 0; j < resources[0].length; j++) { | for (int j = 0; j < resources[0].length; j++) { | ||||
if (resources[0][j].getName().equalsIgnoreCase(MANIFEST_NAME)) { | |||||
if (resources[0][j].getName().toUpperCase(Locale.ENGLISH) | |||||
.equals(MANIFEST_NAME)) { | |||||
manifests[i] = new Resource[] {resources[0][j]}; | manifests[i] = new Resource[] {resources[0][j]}; | ||||
break; | break; | ||||
} | } | ||||
@@ -24,6 +24,7 @@ import java.io.IOException; | |||||
import java.io.OutputStream; | import java.io.OutputStream; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.Locale; | |||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
@@ -88,6 +89,8 @@ public class Javac extends MatchingTask { | |||||
private static final String MODERN = "modern"; | private static final String MODERN = "modern"; | ||||
private static final String CLASSIC = "classic"; | private static final String CLASSIC = "classic"; | ||||
private static final String EXTJAVAC = "extJavac"; | private static final String EXTJAVAC = "extJavac"; | ||||
private static final String EXTJAVAC_LC = | |||||
EXTJAVAC.toLowerCase(Locale.ENGLISH); | |||||
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | ||||
@@ -679,7 +682,9 @@ public class Javac extends MatchingTask { | |||||
* @return true if this is a forked invocation | * @return true if this is a forked invocation | ||||
*/ | */ | ||||
public boolean isForkedJavac() { | public boolean isForkedJavac() { | ||||
return fork || "extJavac".equals(getCompiler()); | |||||
String c = getCompiler(); | |||||
return fork || | |||||
(c != null && EXTJAVAC_LC.equals(c.toLowerCase(Locale.ENGLISH))); | |||||
} | } | ||||
/** | /** | ||||
@@ -758,29 +763,31 @@ public class Javac extends MatchingTask { | |||||
} | } | ||||
private String getAltCompilerName(String anImplementation) { | private String getAltCompilerName(String anImplementation) { | ||||
if (JAVAC16.equalsIgnoreCase(anImplementation) | |||||
|| JAVAC15.equalsIgnoreCase(anImplementation) | |||||
|| JAVAC14.equalsIgnoreCase(anImplementation) | |||||
|| JAVAC13.equalsIgnoreCase(anImplementation)) { | |||||
anImplementation = anImplementation != null | |||||
? anImplementation.toLowerCase(Locale.ENGLISH) : null; | |||||
if (JAVAC16.equals(anImplementation) | |||||
|| JAVAC15.equals(anImplementation) | |||||
|| JAVAC14.equals(anImplementation) | |||||
|| JAVAC13.equals(anImplementation)) { | |||||
return MODERN; | return MODERN; | ||||
} | } | ||||
if (JAVAC12.equalsIgnoreCase(anImplementation) | |||||
|| JAVAC11.equalsIgnoreCase(anImplementation)) { | |||||
if (JAVAC12.equals(anImplementation) | |||||
|| JAVAC11.equals(anImplementation)) { | |||||
return CLASSIC; | return CLASSIC; | ||||
} | } | ||||
if (MODERN.equalsIgnoreCase(anImplementation)) { | |||||
if (MODERN.equals(anImplementation)) { | |||||
String nextSelected = assumedJavaVersion(); | String nextSelected = assumedJavaVersion(); | ||||
if (JAVAC16.equalsIgnoreCase(nextSelected) | |||||
|| JAVAC15.equalsIgnoreCase(nextSelected) | |||||
|| JAVAC14.equalsIgnoreCase(nextSelected) | |||||
|| JAVAC13.equalsIgnoreCase(nextSelected)) { | |||||
if (JAVAC16.equals(nextSelected) | |||||
|| JAVAC15.equals(nextSelected) | |||||
|| JAVAC14.equals(nextSelected) | |||||
|| JAVAC13.equals(nextSelected)) { | |||||
return nextSelected; | return nextSelected; | ||||
} | } | ||||
} | } | ||||
if (CLASSIC.equals(anImplementation)) { | if (CLASSIC.equals(anImplementation)) { | ||||
return assumedJavaVersion(); | return assumedJavaVersion(); | ||||
} | } | ||||
if (EXTJAVAC.equalsIgnoreCase(anImplementation)) { | |||||
if (EXTJAVAC_LC.equals(anImplementation)) { | |||||
return assumedJavaVersion(); | return assumedJavaVersion(); | ||||
} | } | ||||
return null; | return null; | ||||
@@ -1007,7 +1014,7 @@ public class Javac extends MatchingTask { | |||||
String compilerImpl = getCompilerVersion(); | String compilerImpl = getCompilerVersion(); | ||||
if (fork) { | if (fork) { | ||||
if (isJdkCompiler(compilerImpl)) { | if (isJdkCompiler(compilerImpl)) { | ||||
compilerImpl = "extJavac"; | |||||
compilerImpl = EXTJAVAC; | |||||
} else { | } else { | ||||
log("Since compiler setting isn't classic or modern, " | log("Since compiler setting isn't classic or modern, " | ||||
+ "ignoring fork setting.", Project.MSG_WARN); | + "ignoring fork setting.", Project.MSG_WARN); | ||||
@@ -1343,7 +1343,7 @@ public class Javadoc extends Task { | |||||
* specified. | * specified. | ||||
*/ | */ | ||||
public void setScope (String verboseScope) throws BuildException { | public void setScope (String verboseScope) throws BuildException { | ||||
verboseScope = verboseScope.toLowerCase(Locale.US); | |||||
verboseScope = verboseScope.toLowerCase(Locale.ENGLISH); | |||||
boolean[] elements = new boolean[SCOPE_ELEMENTS.length]; | boolean[] elements = new boolean[SCOPE_ELEMENTS.length]; | ||||
@@ -21,6 +21,7 @@ import java.io.BufferedWriter; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileWriter; | import java.io.FileWriter; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
@@ -81,7 +82,7 @@ public class Jikes { | |||||
// Windows has a 32k limit on total arg size, so | // Windows has a 32k limit on total arg size, so | ||||
// create a temporary file to store all the arguments | // create a temporary file to store all the arguments | ||||
if (myos.toLowerCase().indexOf("windows") >= 0 | |||||
if (myos.toLowerCase(Locale.ENGLISH).indexOf("windows") >= 0 | |||||
&& args.length > MAX_FILES_ON_COMMAND_LINE) { | && args.length > MAX_FILES_ON_COMMAND_LINE) { | ||||
BufferedWriter out = null; | BufferedWriter out = null; | ||||
try { | try { | ||||
@@ -339,7 +339,7 @@ public class MacroDef extends AntlibDefinition { | |||||
throw new BuildException( | throw new BuildException( | ||||
"Illegal name [" + name + "] for attribute"); | "Illegal name [" + name + "] for attribute"); | ||||
} | } | ||||
this.name = name.toLowerCase(Locale.US); | |||||
this.name = name.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -443,7 +443,7 @@ public class MacroDef extends AntlibDefinition { | |||||
throw new BuildException( | throw new BuildException( | ||||
"Illegal name [" + name + "] for attribute"); | "Illegal name [" + name + "] for attribute"); | ||||
} | } | ||||
this.name = name.toLowerCase(Locale.US); | |||||
this.name = name.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -567,7 +567,7 @@ public class MacroDef extends AntlibDefinition { | |||||
throw new BuildException( | throw new BuildException( | ||||
"Illegal name [" + name + "] for macro element"); | "Illegal name [" + name + "] for macro element"); | ||||
} | } | ||||
this.name = name.toLowerCase(Locale.US); | |||||
this.name = name.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -127,7 +127,7 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain | |||||
for (Iterator i = unknownElements.iterator(); i.hasNext();) { | for (Iterator i = unknownElements.iterator(); i.hasNext();) { | ||||
UnknownElement ue = (UnknownElement) i.next(); | UnknownElement ue = (UnknownElement) i.next(); | ||||
String name = ProjectHelper.extractNameFromComponentName( | String name = ProjectHelper.extractNameFromComponentName( | ||||
ue.getTag()).toLowerCase(Locale.US); | |||||
ue.getTag()).toLowerCase(Locale.ENGLISH); | |||||
if (getNsElements().get(name) == null) { | if (getNsElements().get(name) == null) { | ||||
throw new BuildException("unsupported element " + name); | throw new BuildException("unsupported element " + name); | ||||
} | } | ||||
@@ -199,7 +199,7 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain | |||||
case STATE_EXPECT_NAME: | case STATE_EXPECT_NAME: | ||||
if (ch == '}') { | if (ch == '}') { | ||||
state = STATE_NORMAL; | state = STATE_NORMAL; | ||||
String name = macroName.toString().toLowerCase(Locale.US); | |||||
String name = macroName.toString().toLowerCase(Locale.ENGLISH); | |||||
String value = (String) macroMapping.get(name); | String value = (String) macroMapping.get(name); | ||||
if (value == null) { | if (value == null) { | ||||
ret.append("@{"); | ret.append("@{"); | ||||
@@ -278,7 +278,7 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain | |||||
UnknownElement unknownElement = (UnknownElement) r.getProxy(); | UnknownElement unknownElement = (UnknownElement) r.getProxy(); | ||||
String tag = unknownElement.getTaskType(); | String tag = unknownElement.getTaskType(); | ||||
if (tag != null) { | if (tag != null) { | ||||
tag = tag.toLowerCase(Locale.US); | |||||
tag = tag.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
MacroDef.TemplateElement templateElement = | MacroDef.TemplateElement templateElement = | ||||
(MacroDef.TemplateElement) getNsElements().get(tag); | (MacroDef.TemplateElement) getNsElements().get(tag); | ||||
@@ -29,6 +29,7 @@ import java.io.UnsupportedEncodingException; | |||||
import java.util.Enumeration; | import java.util.Enumeration; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.LinkedHashMap; | import java.util.LinkedHashMap; | ||||
import java.util.Locale; | |||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
@@ -90,6 +91,15 @@ public class Manifest { | |||||
/** Encoding to be used for JAR files. */ | /** Encoding to be used for JAR files. */ | ||||
public static final String JAR_ENCODING = "UTF-8"; | public static final String JAR_ENCODING = "UTF-8"; | ||||
private static final String ATTRIBUTE_MANIFEST_VERSION_LC = | |||||
ATTRIBUTE_MANIFEST_VERSION.toLowerCase(Locale.ENGLISH); | |||||
private static final String ATTRIBUTE_NAME_LC = | |||||
ATTRIBUTE_NAME.toLowerCase(Locale.ENGLISH); | |||||
private static final String ATTRIBUTE_FROM_LC = | |||||
ATTRIBUTE_FROM.toLowerCase(Locale.ENGLISH); | |||||
private static final String ATTRIBUTE_CLASSPATH_LC = | |||||
ATTRIBUTE_CLASSPATH.toLowerCase(Locale.ENGLISH); | |||||
/** | /** | ||||
* An attribute for the manifest. | * An attribute for the manifest. | ||||
* Those attributes that are not nested into a section will be added to the "Main" section. | * Those attributes that are not nested into a section will be added to the "Main" section. | ||||
@@ -238,7 +248,7 @@ public class Manifest { | |||||
if (name == null) { | if (name == null) { | ||||
return null; | return null; | ||||
} | } | ||||
return name.toLowerCase(); | |||||
return name.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -491,8 +501,10 @@ public class Manifest { | |||||
public void merge(Section section, boolean mergeClassPaths) | public void merge(Section section, boolean mergeClassPaths) | ||||
throws ManifestException { | throws ManifestException { | ||||
if (name == null && section.getName() != null | if (name == null && section.getName() != null | ||||
|| name != null | |||||
&& !(name.equalsIgnoreCase(section.getName()))) { | |||||
|| (name != null && section.getName() != null | |||||
&& !(name.toLowerCase(Locale.ENGLISH) | |||||
.equals(section.getName().toLowerCase(Locale.ENGLISH)))) | |||||
) { | |||||
throw new ManifestException("Unable to merge sections " | throw new ManifestException("Unable to merge sections " | ||||
+ "with different names"); | + "with different names"); | ||||
} | } | ||||
@@ -501,8 +513,10 @@ public class Manifest { | |||||
Attribute classpathAttribute = null; | Attribute classpathAttribute = null; | ||||
while (e.hasMoreElements()) { | while (e.hasMoreElements()) { | ||||
String attributeName = (String) e.nextElement(); | String attributeName = (String) e.nextElement(); | ||||
String attributeNameLC = | |||||
attributeName.toLowerCase(Locale.ENGLISH); | |||||
Attribute attribute = section.getAttribute(attributeName); | Attribute attribute = section.getAttribute(attributeName); | ||||
if (attributeName.equalsIgnoreCase(ATTRIBUTE_CLASSPATH)) { | |||||
if (attributeNameLC.equals(ATTRIBUTE_CLASSPATH_LC)) { | |||||
if (classpathAttribute == null) { | if (classpathAttribute == null) { | ||||
classpathAttribute = new Attribute(); | classpathAttribute = new Attribute(); | ||||
classpathAttribute.setName(ATTRIBUTE_CLASSPATH); | classpathAttribute.setName(ATTRIBUTE_CLASSPATH); | ||||
@@ -586,7 +600,7 @@ public class Manifest { | |||||
* instances. | * instances. | ||||
*/ | */ | ||||
public Attribute getAttribute(String attributeName) { | public Attribute getAttribute(String attributeName) { | ||||
return (Attribute) attributes.get(attributeName.toLowerCase()); | |||||
return (Attribute) attributes.get(attributeName.toLowerCase(Locale.ENGLISH)); | |||||
} | } | ||||
/** | /** | ||||
@@ -608,7 +622,7 @@ public class Manifest { | |||||
* in the section | * in the section | ||||
*/ | */ | ||||
public String getAttributeValue(String attributeName) { | public String getAttributeValue(String attributeName) { | ||||
Attribute attribute = getAttribute(attributeName.toLowerCase()); | |||||
Attribute attribute = getAttribute(attributeName.toLowerCase(Locale.ENGLISH)); | |||||
if (attribute == null) { | if (attribute == null) { | ||||
return null; | return null; | ||||
} | } | ||||
@@ -621,7 +635,7 @@ public class Manifest { | |||||
* @param attributeName the name of the attribute to be removed. | * @param attributeName the name of the attribute to be removed. | ||||
*/ | */ | ||||
public void removeAttribute(String attributeName) { | public void removeAttribute(String attributeName) { | ||||
String key = attributeName.toLowerCase(); | |||||
String key = attributeName.toLowerCase(Locale.ENGLISH); | |||||
attributes.remove(key); | attributes.remove(key); | ||||
} | } | ||||
@@ -658,7 +672,8 @@ public class Manifest { | |||||
if (attribute.getName() == null || attribute.getValue() == null) { | if (attribute.getName() == null || attribute.getValue() == null) { | ||||
throw new BuildException("Attributes must have name and value"); | throw new BuildException("Attributes must have name and value"); | ||||
} | } | ||||
if (attribute.getKey().equalsIgnoreCase(ATTRIBUTE_NAME)) { | |||||
String attributeKey = attribute.getKey(); | |||||
if (attributeKey.equals(ATTRIBUTE_NAME_LC)) { | |||||
warnings.addElement("\"" + ATTRIBUTE_NAME + "\" attributes " | warnings.addElement("\"" + ATTRIBUTE_NAME + "\" attributes " | ||||
+ "should not occur in the main section and must be the " | + "should not occur in the main section and must be the " | ||||
+ "first element in all other sections: \"" | + "first element in all other sections: \"" | ||||
@@ -666,13 +681,12 @@ public class Manifest { | |||||
return attribute.getValue(); | return attribute.getValue(); | ||||
} | } | ||||
if (attribute.getKey().startsWith(ATTRIBUTE_FROM.toLowerCase())) { | |||||
if (attributeKey.startsWith(ATTRIBUTE_FROM_LC)) { | |||||
warnings.addElement(ERROR_FROM_FORBIDDEN | warnings.addElement(ERROR_FROM_FORBIDDEN | ||||
+ attribute.getName() + ": " + attribute.getValue() + "\""); | + attribute.getName() + ": " + attribute.getValue() + "\""); | ||||
} else { | } else { | ||||
// classpath attributes go into a vector | // classpath attributes go into a vector | ||||
String attributeKey = attribute.getKey(); | |||||
if (attributeKey.equalsIgnoreCase(ATTRIBUTE_CLASSPATH)) { | |||||
if (attributeKey.equals(ATTRIBUTE_CLASSPATH_LC)) { | |||||
Attribute classpathAttribute = | Attribute classpathAttribute = | ||||
(Attribute) attributes.get(attributeKey); | (Attribute) attributes.get(attributeKey); | ||||
@@ -856,7 +870,8 @@ public class Manifest { | |||||
Section section = new Section(); | Section section = new Section(); | ||||
if (nextSectionName == null) { | if (nextSectionName == null) { | ||||
Attribute sectionName = new Attribute(line); | Attribute sectionName = new Attribute(line); | ||||
if (!sectionName.getName().equalsIgnoreCase(ATTRIBUTE_NAME)) { | |||||
if (!sectionName.getName().toLowerCase(Locale.ENGLISH) | |||||
.equals(ATTRIBUTE_NAME_LC)) { | |||||
throw new ManifestException("Manifest sections should " | throw new ManifestException("Manifest sections should " | ||||
+ "start with a \"" + ATTRIBUTE_NAME | + "start with a \"" + ATTRIBUTE_NAME | ||||
+ "\" attribute and not \"" | + "\" attribute and not \"" | ||||
@@ -905,7 +920,7 @@ public class Manifest { | |||||
if (attribute.getKey() == null || attribute.getValue() == null) { | if (attribute.getKey() == null || attribute.getValue() == null) { | ||||
throw new BuildException("Attributes must have name and value"); | throw new BuildException("Attributes must have name and value"); | ||||
} | } | ||||
if (attribute.getKey().equalsIgnoreCase(ATTRIBUTE_MANIFEST_VERSION)) { | |||||
if (attribute.getKey().equals(ATTRIBUTE_MANIFEST_VERSION_LC)) { | |||||
manifestVersion = attribute.getValue(); | manifestVersion = attribute.getValue(); | ||||
} else { | } else { | ||||
mainSection.addConfiguredAttribute(attribute); | mainSection.addConfiguredAttribute(attribute); | ||||
@@ -19,6 +19,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.util.Hashtable; | import java.util.Hashtable; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.Locale; | |||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.tools.ant.BuildEvent; | import org.apache.tools.ant.BuildEvent; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
@@ -101,7 +102,7 @@ public class Recorder extends Task implements SubBuildListener { | |||||
* @param action The action for the entry to take: start or stop. | * @param action The action for the entry to take: start or stop. | ||||
*/ | */ | ||||
public void setAction(ActionChoices action) { | public void setAction(ActionChoices action) { | ||||
if (action.getValue().equalsIgnoreCase("start")) { | |||||
if (action.getValue().toLowerCase(Locale.ENGLISH).equals("start")) { | |||||
start = Boolean.TRUE; | start = Boolean.TRUE; | ||||
} else { | } else { | ||||
start = Boolean.FALSE; | start = Boolean.FALSE; | ||||
@@ -726,7 +726,8 @@ public class SQLExec extends JDBCTask { | |||||
StringTokenizer st = new StringTokenizer(line); | StringTokenizer st = new StringTokenizer(line); | ||||
if (st.hasMoreTokens()) { | if (st.hasMoreTokens()) { | ||||
String token = st.nextToken(); | String token = st.nextToken(); | ||||
if ("REM".equalsIgnoreCase(token)) { | |||||
if (token != null | |||||
&& "REM".equals(token.toUpperCase(Locale.ENGLISH))) { | |||||
continue; | continue; | ||||
} | } | ||||
} | } | ||||
@@ -1072,7 +1073,7 @@ public class SQLExec extends JDBCTask { | |||||
// no match | // no match | ||||
return -1; | return -1; | ||||
} else { | } else { | ||||
String d = delimiter.trim().toLowerCase(Locale.US); | |||||
String d = delimiter.trim().toLowerCase(Locale.ENGLISH); | |||||
if (delimiterType.equals(DelimiterType.NORMAL)) { | if (delimiterType.equals(DelimiterType.NORMAL)) { | ||||
// still trying to avoid wasteful copying, see | // still trying to avoid wasteful copying, see | ||||
// StringUtils.endsWith | // StringUtils.endsWith | ||||
@@ -1087,7 +1088,7 @@ public class SQLExec extends JDBCTask { | |||||
} | } | ||||
while (endIndex >= 0) { | while (endIndex >= 0) { | ||||
if (buf.substring(bufferIndex, bufferIndex + 1) | if (buf.substring(bufferIndex, bufferIndex + 1) | ||||
.toLowerCase(Locale.US).charAt(0) | |||||
.toLowerCase(Locale.ENGLISH).charAt(0) | |||||
!= d.charAt(endIndex)) { | != d.charAt(endIndex)) { | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -1096,7 +1097,7 @@ public class SQLExec extends JDBCTask { | |||||
} | } | ||||
return bufferIndex + 1; | return bufferIndex + 1; | ||||
} else { | } else { | ||||
return currentLine.trim().toLowerCase(Locale.US).equals(d) | |||||
return currentLine.trim().toLowerCase(Locale.ENGLISH).equals(d) | |||||
? buf.length() - currentLine.length() : -1; | ? buf.length() - currentLine.length() : -1; | ||||
} | } | ||||
} | } | ||||
@@ -871,35 +871,35 @@ public class Tar extends MatchingTask { | |||||
* @return true if value is "truncate". | * @return true if value is "truncate". | ||||
*/ | */ | ||||
public boolean isTruncateMode() { | public boolean isTruncateMode() { | ||||
return TRUNCATE.equalsIgnoreCase(getValue()); | |||||
return equalsIgnoreCase(TRUNCATE, getValue()); | |||||
} | } | ||||
/** | /** | ||||
* @return true if value is "warn". | * @return true if value is "warn". | ||||
*/ | */ | ||||
public boolean isWarnMode() { | public boolean isWarnMode() { | ||||
return WARN.equalsIgnoreCase(getValue()); | |||||
return equalsIgnoreCase(WARN, getValue()); | |||||
} | } | ||||
/** | /** | ||||
* @return true if value is "gnu". | * @return true if value is "gnu". | ||||
*/ | */ | ||||
public boolean isGnuMode() { | public boolean isGnuMode() { | ||||
return GNU.equalsIgnoreCase(getValue()); | |||||
return equalsIgnoreCase(GNU, getValue()); | |||||
} | } | ||||
/** | /** | ||||
* @return true if value is "fail". | * @return true if value is "fail". | ||||
*/ | */ | ||||
public boolean isFailMode() { | public boolean isFailMode() { | ||||
return FAIL.equalsIgnoreCase(getValue()); | |||||
return equalsIgnoreCase(FAIL, getValue()); | |||||
} | } | ||||
/** | /** | ||||
* @return true if value is "omit". | * @return true if value is "omit". | ||||
*/ | */ | ||||
public boolean isOmitMode() { | public boolean isOmitMode() { | ||||
return OMIT.equalsIgnoreCase(getValue()); | |||||
return equalsIgnoreCase(OMIT, getValue()); | |||||
} | } | ||||
} | } | ||||
@@ -233,7 +233,8 @@ public class Touch extends Task { | |||||
} | } | ||||
if (dateTime != null && !dateTimeConfigured) { | if (dateTime != null && !dateTimeConfigured) { | ||||
long workmillis = millis; | long workmillis = millis; | ||||
if ("now".equalsIgnoreCase(dateTime)) { | |||||
if (dateTime != null | |||||
&& "now".equals(dateTime.toLowerCase(Locale.ENGLISH))) { | |||||
workmillis = System.currentTimeMillis(); | workmillis = System.currentTimeMillis(); | ||||
} else { | } else { | ||||
DateFormat df = dfFactory.getPrimaryFormat(); | DateFormat df = dfFactory.getPrimaryFormat(); | ||||
@@ -324,7 +324,7 @@ public class Tstamp extends Task { | |||||
* @return an int value. | * @return an int value. | ||||
*/ | */ | ||||
public int getCalendarField() { | public int getCalendarField() { | ||||
String key = getValue().toLowerCase(); | |||||
String key = getValue().toLowerCase(Locale.ENGLISH); | |||||
Integer i = (Integer) calendarFields.get(key); | Integer i = (Integer) calendarFields.get(key); | ||||
return i.intValue(); | return i.intValue(); | ||||
} | } | ||||
@@ -19,6 +19,7 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Locale; | |||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
@@ -259,7 +260,7 @@ public class WaitFor extends ConditionBase { | |||||
* @return a multipler (a long value) | * @return a multipler (a long value) | ||||
*/ | */ | ||||
public long getMultiplier() { | public long getMultiplier() { | ||||
String key = getValue().toLowerCase(); | |||||
String key = getValue().toLowerCase(Locale.ENGLISH); | |||||
Long l = (Long) timeTable.get(key); | Long l = (Long) timeTable.get(key); | ||||
return l.longValue(); | return l.longValue(); | ||||
} | } | ||||
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.io.File; | import java.io.File; | ||||
import java.util.Enumeration; | import java.util.Enumeration; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.Locale; | |||||
import java.util.Vector; | import java.util.Vector; | ||||
import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
@@ -1366,14 +1367,18 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
*/ | */ | ||||
public void setDynamicAttribute(String name, String value) throws BuildException { | public void setDynamicAttribute(String name, String value) throws BuildException { | ||||
// only 'name' and 'value' exist. | // only 'name' and 'value' exist. | ||||
if ("name".equalsIgnoreCase(name)) { | |||||
String nameLC = name != null | |||||
? name.toLowerCase(Locale.ENGLISH) : null; | |||||
if ("name".equals(nameLC)) { | |||||
this.name = value; | this.name = value; | ||||
} else if ("value".equalsIgnoreCase(name)) { | |||||
} else if ("value".equals(nameLC)) { | |||||
// a value must be of a given type | // a value must be of a given type | ||||
// say boolean|integer|string that are mostly used. | // say boolean|integer|string that are mostly used. | ||||
if ("true".equalsIgnoreCase(value)) { | |||||
String valueLC = value != null | |||||
? value.toLowerCase(Locale.ENGLISH) : null; | |||||
if ("true".equals(valueLC)) { | |||||
this.value = Boolean.TRUE; | this.value = Boolean.TRUE; | ||||
} else if ("false".equalsIgnoreCase(value)) { | |||||
} else if ("false".equals(valueLC)) { | |||||
this.value = Boolean.FALSE; | this.value = Boolean.FALSE; | ||||
} else { | } else { | ||||
try { | try { | ||||
@@ -18,6 +18,7 @@ | |||||
package org.apache.tools.ant.taskdefs.compilers; | package org.apache.tools.ant.taskdefs.compilers; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
@@ -98,28 +99,29 @@ public final class CompilerAdapterFactory { | |||||
public static CompilerAdapter getCompiler(String compilerType, Task task, | public static CompilerAdapter getCompiler(String compilerType, Task task, | ||||
Path classpath) | Path classpath) | ||||
throws BuildException { | throws BuildException { | ||||
if (compilerType.equalsIgnoreCase("jikes")) { | |||||
String compilerTypeLC = compilerType.toLowerCase(Locale.ENGLISH); | |||||
if (compilerTypeLC.equals("jikes")) { | |||||
return new Jikes(); | return new Jikes(); | ||||
} | } | ||||
if (compilerType.equalsIgnoreCase("extJavac")) { | |||||
if (compilerTypeLC.equals("extjavac")) { | |||||
return new JavacExternal(); | return new JavacExternal(); | ||||
} | } | ||||
if (compilerType.equalsIgnoreCase("classic") | |||||
|| compilerType.equalsIgnoreCase("javac1.1") | |||||
|| compilerType.equalsIgnoreCase("javac1.2")) { | |||||
if (compilerTypeLC.equals("classic") | |||||
|| compilerTypeLC.equals("javac1.1") | |||||
|| compilerTypeLC.equals("javac1.2")) { | |||||
task.log("This version of java does " | task.log("This version of java does " | ||||
+ "not support the classic " | + "not support the classic " | ||||
+ "compiler; upgrading to modern", | + "compiler; upgrading to modern", | ||||
Project.MSG_WARN); | Project.MSG_WARN); | ||||
compilerType = "modern"; | |||||
compilerTypeLC = "modern"; | |||||
} | } | ||||
//on java<=1.3 the modern falls back to classic if it is not found | //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 | //but on java>=1.4 we just bail out early | ||||
if (compilerType.equalsIgnoreCase("modern") | |||||
|| compilerType.equalsIgnoreCase("javac1.3") | |||||
|| compilerType.equalsIgnoreCase("javac1.4") | |||||
|| compilerType.equalsIgnoreCase("javac1.5") | |||||
|| compilerType.equalsIgnoreCase("javac1.6")) { | |||||
if (compilerTypeLC.equals("modern") | |||||
|| compilerTypeLC.equals("javac1.3") | |||||
|| compilerTypeLC.equals("javac1.4") | |||||
|| compilerTypeLC.equals("javac1.5") | |||||
|| compilerTypeLC.equals("javac1.6")) { | |||||
// does the modern compiler exist? | // does the modern compiler exist? | ||||
if (doesModernCompilerExist()) { | if (doesModernCompilerExist()) { | ||||
return new Javac13(); | return new Javac13(); | ||||
@@ -137,18 +139,18 @@ public final class CompilerAdapterFactory { | |||||
} | } | ||||
} | } | ||||
if (compilerType.equalsIgnoreCase("jvc") | |||||
|| compilerType.equalsIgnoreCase("microsoft")) { | |||||
if (compilerTypeLC.equals("jvc") | |||||
|| compilerTypeLC.equals("microsoft")) { | |||||
return new Jvc(); | return new Jvc(); | ||||
} | } | ||||
if (compilerType.equalsIgnoreCase("kjc")) { | |||||
if (compilerTypeLC.equals("kjc")) { | |||||
return new Kjc(); | return new Kjc(); | ||||
} | } | ||||
if (compilerType.equalsIgnoreCase("gcj")) { | |||||
if (compilerTypeLC.equals("gcj")) { | |||||
return new Gcj(); | return new Gcj(); | ||||
} | } | ||||
if (compilerType.equalsIgnoreCase("sj") | |||||
|| compilerType.equalsIgnoreCase("symantec")) { | |||||
if (compilerTypeLC.equals("sj") | |||||
|| compilerTypeLC.equals("symantec")) { | |||||
return new Sj(); | return new Sj(); | ||||
} | } | ||||
return resolveClassName(compilerType, | return resolveClassName(compilerType, | ||||
@@ -75,7 +75,7 @@ public class Http extends ProjectComponent implements Condition { | |||||
*/ | */ | ||||
public void setRequestMethod(String method) { | public void setRequestMethod(String method) { | ||||
this.requestMethod = method == null ? DEFAULT_REQUEST_METHOD | this.requestMethod = method == null ? DEFAULT_REQUEST_METHOD | ||||
: method.toUpperCase(Locale.US); | |||||
: method.toUpperCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -22,6 +22,7 @@ import java.text.DateFormat; | |||||
import java.text.ParseException; | import java.text.ParseException; | ||||
import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
@@ -119,7 +120,8 @@ public class IsLastModified extends ProjectComponent implements Condition { | |||||
if (millis >= 0) { | if (millis >= 0) { | ||||
return millis; | return millis; | ||||
} | } | ||||
if ("now".equalsIgnoreCase(dateTime)) { | |||||
if (dateTime != null | |||||
&& "now".equals(dateTime.toLowerCase(Locale.ENGLISH))) { | |||||
return System.currentTimeMillis(); | return System.currentTimeMillis(); | ||||
} | } | ||||
DateFormat df = dfFactory.getPrimaryFormat(); | DateFormat df = dfFactory.getPrimaryFormat(); | ||||
@@ -29,11 +29,11 @@ import org.apache.tools.ant.BuildException; | |||||
*/ | */ | ||||
public class Os implements Condition { | public class Os implements Condition { | ||||
private static final String OS_NAME = | private static final String OS_NAME = | ||||
System.getProperty("os.name").toLowerCase(Locale.US); | |||||
System.getProperty("os.name").toLowerCase(Locale.ENGLISH); | |||||
private static final String OS_ARCH = | private static final String OS_ARCH = | ||||
System.getProperty("os.arch").toLowerCase(Locale.US); | |||||
System.getProperty("os.arch").toLowerCase(Locale.ENGLISH); | |||||
private static final String OS_VERSION = | private static final String OS_VERSION = | ||||
System.getProperty("os.version").toLowerCase(Locale.US); | |||||
System.getProperty("os.version").toLowerCase(Locale.ENGLISH); | |||||
private static final String PATH_SEP = | private static final String PATH_SEP = | ||||
System.getProperty("path.separator"); | System.getProperty("path.separator"); | ||||
@@ -142,7 +142,7 @@ public class Os implements Condition { | |||||
* </ul> | * </ul> | ||||
*/ | */ | ||||
public void setFamily(String f) { | public void setFamily(String f) { | ||||
family = f.toLowerCase(Locale.US); | |||||
family = f.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -151,7 +151,7 @@ public class Os implements Condition { | |||||
* @param name The OS name | * @param name The OS name | ||||
*/ | */ | ||||
public void setName(String name) { | public void setName(String name) { | ||||
this.name = name.toLowerCase(Locale.US); | |||||
this.name = name.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -160,7 +160,7 @@ public class Os implements Condition { | |||||
* @param arch The OS architecture | * @param arch The OS architecture | ||||
*/ | */ | ||||
public void setArch(String arch) { | public void setArch(String arch) { | ||||
this.arch = arch.toLowerCase(Locale.US); | |||||
this.arch = arch.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -169,7 +169,7 @@ public class Os implements Condition { | |||||
* @param version The OS version | * @param version The OS version | ||||
*/ | */ | ||||
public void setVersion(String version) { | public void setVersion(String version) { | ||||
this.version = version.toLowerCase(Locale.US); | |||||
this.version = version.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -26,11 +26,12 @@ import java.io.ByteArrayInputStream; | |||||
import java.io.ByteArrayOutputStream; | import java.io.ByteArrayOutputStream; | ||||
import java.io.UnsupportedEncodingException; | import java.io.UnsupportedEncodingException; | ||||
import java.util.Vector; | |||||
import java.util.Enumeration; | |||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.Locale; | |||||
import java.util.Properties; | import java.util.Properties; | ||||
import java.util.Enumeration; | |||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import java.util.Vector; | |||||
import java.security.Provider; | import java.security.Provider; | ||||
import java.security.Security; | import java.security.Security; | ||||
@@ -100,7 +101,7 @@ public class MimeMailer extends Mailer { | |||||
} | } | ||||
public void setContentType(String type) { | public void setContentType(String type) { | ||||
this.type = type.toLowerCase(); | |||||
this.type = type.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
public String getContentType() { | public String getContentType() { | ||||
@@ -20,6 +20,7 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.ejb; | package org.apache.tools.ant.taskdefs.optional.ejb; | ||||
import java.io.File; | import java.io.File; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
@@ -167,7 +168,7 @@ public class BorlandGenerateClient extends Task { | |||||
log("client jar file is " + clientjarfile); | log("client jar file is " + clientjarfile); | ||||
if (mode.equalsIgnoreCase(FORK_MODE)) { | |||||
if (mode.toLowerCase(Locale.ENGLISH).equals(FORK_MODE)) { | |||||
executeFork(); | executeFork(); | ||||
} else { | } else { | ||||
executeJava(); | executeJava(); | ||||
@@ -40,6 +40,7 @@ import java.io.FileOutputStream; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.Locale; | |||||
import java.util.Vector; | import java.util.Vector; | ||||
/** | /** | ||||
@@ -316,7 +317,8 @@ public class Image extends MatchingTask { | |||||
try { | try { | ||||
stream = new FileOutputStream(newFile); | stream = new FileOutputStream(newFile); | ||||
JAI.create("encode", image, stream, str_encoding.toUpperCase(), | |||||
JAI.create("encode", image, stream, | |||||
str_encoding.toUpperCase(Locale.ENGLISH), | |||||
null); | null); | ||||
stream.flush(); | stream.flush(); | ||||
} finally { | } finally { | ||||
@@ -406,9 +408,10 @@ public class Image extends MatchingTask { | |||||
if (srcDir == null && destDir == null) { | if (srcDir == null && destDir == null) { | ||||
throw new BuildException("Specify the destDir, or the srcDir."); | throw new BuildException("Specify the destDir, or the srcDir."); | ||||
} | } | ||||
if (str_encoding.toLowerCase().equals("jpg")) { | |||||
String enc = str_encoding.toLowerCase(Locale.ENGLISH); | |||||
if (enc.equals("jpg")) { | |||||
str_encoding = "JPEG"; | str_encoding = "JPEG"; | ||||
} else if (str_encoding.toLowerCase().equals("tif")) { | |||||
} else if (enc.equals("tif")) { | |||||
str_encoding = "TIFF"; | str_encoding = "TIFF"; | ||||
} | } | ||||
} | } | ||||
@@ -17,6 +17,7 @@ | |||||
*/ | */ | ||||
package org.apache.tools.ant.taskdefs.optional.jsp.compilers; | package org.apache.tools.ant.taskdefs.optional.jsp.compilers; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.AntClassLoader; | import org.apache.tools.ant.AntClassLoader; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
@@ -80,11 +81,12 @@ public final class JspCompilerAdapterFactory { | |||||
AntClassLoader loader) | AntClassLoader loader) | ||||
throws BuildException { | throws BuildException { | ||||
if (compilerType.equalsIgnoreCase("jasper")) { | |||||
String compilerTypeLC = compilerType.toLowerCase(Locale.ENGLISH); | |||||
if (compilerTypeLC.equals("jasper")) { | |||||
//tomcat4.0 gets the old mangler | //tomcat4.0 gets the old mangler | ||||
return new JasperC(new JspNameMangler()); | return new JasperC(new JspNameMangler()); | ||||
} | } | ||||
if (compilerType.equalsIgnoreCase("jasper41")) { | |||||
if (compilerTypeLC.equals("jasper41")) { | |||||
//tomcat4.1 gets the new one | //tomcat4.1 gets the new one | ||||
return new JasperC(new Jasper41Mangler()); | return new JasperC(new Jasper41Mangler()); | ||||
} | } | ||||
@@ -1569,7 +1569,9 @@ public class JUnitTask extends Task { | |||||
if (summary) { | if (summary) { | ||||
JUnitTaskMirror.SummaryJUnitResultFormatterMirror f = | JUnitTaskMirror.SummaryJUnitResultFormatterMirror f = | ||||
delegate.newSummaryJUnitResultFormatter(); | delegate.newSummaryJUnitResultFormatter(); | ||||
f.setWithOutAndErr("withoutanderr".equalsIgnoreCase(summaryValue)); | |||||
String s = summaryValue != null | |||||
? summaryValue.toLowerCase(Locale.ENGLISH) : null; | |||||
f.setWithOutAndErr("withoutanderr".equals(s)); | |||||
delegate.addVmExit(test, f, getDefaultOutput(), message, testCase); | delegate.addVmExit(test, f, getDefaultOutput(), message, testCase); | ||||
} | } | ||||
} finally { | } finally { | ||||
@@ -1536,7 +1536,9 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
* synonym for -1. | * synonym for -1. | ||||
*/ | */ | ||||
public void setRetriesAllowed(String retriesAllowed) { | public void setRetriesAllowed(String retriesAllowed) { | ||||
if ("FOREVER".equalsIgnoreCase(retriesAllowed)) { | |||||
String r = retriesAllowed != null | |||||
? retriesAllowed.toUpperCase(Locale.ENGLISH) : null; | |||||
if ("FOREVER".equals(r)) { | |||||
this.retriesAllowed = Retryable.RETRY_FOREVER; | this.retriesAllowed = Retryable.RETRY_FOREVER; | ||||
} else { | } else { | ||||
try { | try { | ||||
@@ -2568,7 +2570,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
* @return the SYMBOL representing the given action. | * @return the SYMBOL representing the given action. | ||||
*/ | */ | ||||
public int getAction() { | public int getAction() { | ||||
String actionL = getValue().toLowerCase(Locale.US); | |||||
String actionL = getValue().toLowerCase(Locale.ENGLISH); | |||||
if (actionL.equals("send") || actionL.equals("put")) { | if (actionL.equals("send") || actionL.equals("put")) { | ||||
return SEND_FILES; | return SEND_FILES; | ||||
@@ -2627,7 +2629,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
* the attribute, in the context of the supplied action | * the attribute, in the context of the supplied action | ||||
*/ | */ | ||||
public long getMilliseconds(int action) { | public long getMilliseconds(int action) { | ||||
String granularityU = getValue().toUpperCase(Locale.US); | |||||
String granularityU = getValue().toUpperCase(Locale.ENGLISH); | |||||
if ("".equals(granularityU)) { | if ("".equals(granularityU)) { | ||||
if (action == SEND_FILES) { | if (action == SEND_FILES) { | ||||
@@ -588,7 +588,9 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||||
* synonym for -1. | * synonym for -1. | ||||
*/ | */ | ||||
public void setRetriesAllowed(String retriesAllowed) { | public void setRetriesAllowed(String retriesAllowed) { | ||||
if ("FOREVER".equalsIgnoreCase(retriesAllowed)) { | |||||
String r = retriesAllowed != null | |||||
? retriesAllowed.toUpperCase(Locale.ENGLISH) : null; | |||||
if ("FOREVER".equals(r)) { | |||||
this.retriesAllowed = Retryable.RETRY_FOREVER; | this.retriesAllowed = Retryable.RETRY_FOREVER; | ||||
} else { | } else { | ||||
try { | try { | ||||
@@ -862,7 +864,7 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||||
* @return the SYMBOL representing the given action. | * @return the SYMBOL representing the given action. | ||||
*/ | */ | ||||
public int getAction() { | public int getAction() { | ||||
String actionL = getValue().toLowerCase(Locale.US); | |||||
String actionL = getValue().toLowerCase(Locale.ENGLISH); | |||||
if (actionL.equals("send") || actionL.equals("put")) { | if (actionL.equals("send") || actionL.equals("put")) { | ||||
return SEND_FILES; | return SEND_FILES; | ||||
@@ -921,7 +923,7 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||||
* the attribute, in the context of the supplied action | * the attribute, in the context of the supplied action | ||||
*/ | */ | ||||
public long getMilliseconds(int action) { | public long getMilliseconds(int action) { | ||||
String granularityU = getValue().toUpperCase(Locale.US); | |||||
String granularityU = getValue().toUpperCase(Locale.ENGLISH); | |||||
if ("".equals(granularityU)) { | if ("".equals(granularityU)) { | ||||
if (action == SEND_FILES) { | if (action == SEND_FILES) { | ||||
@@ -27,6 +27,7 @@ package org.apache.tools.ant.taskdefs.optional.perforce; | |||||
import java.io.File; | import java.io.File; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
@@ -83,11 +84,12 @@ public class P4Fstat extends P4Base { | |||||
* @param filter should be one of all|existing|non-existing. | * @param filter should be one of all|existing|non-existing. | ||||
*/ | */ | ||||
public void setShowFilter(String filter) { | public void setShowFilter(String filter) { | ||||
if (filter.equalsIgnoreCase("all")) { | |||||
filter = filter.toLowerCase(Locale.ENGLISH); | |||||
if (filter.equals("all")) { | |||||
show = SHOW_ALL; | show = SHOW_ALL; | ||||
} else if (filter.equalsIgnoreCase("existing")) { | |||||
} else if (filter.equals("existing")) { | |||||
show = SHOW_EXISTING; | show = SHOW_EXISTING; | ||||
} else if (filter.equalsIgnoreCase("non-existing")) { | |||||
} else if (filter.equals("non-existing")) { | |||||
show = SHOW_NON_EXISTING; | show = SHOW_NON_EXISTING; | ||||
} else { | } else { | ||||
throw new BuildException("P4Fstat: ShowFilter should be one of: " | throw new BuildException("P4Fstat: ShowFilter should be one of: " | ||||
@@ -25,6 +25,7 @@ package org.apache.tools.ant.taskdefs.optional.perforce; | |||||
import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.util.StringUtils; | import org.apache.tools.ant.util.StringUtils; | ||||
@@ -95,7 +96,7 @@ public class P4Label extends P4Base { | |||||
desc = "AntLabel"; | desc = "AntLabel"; | ||||
} | } | ||||
if (lock != null && !lock.equalsIgnoreCase("locked")) { | |||||
if (lock != null && !lock.toLowerCase(Locale.ENGLISH).equals("locked")) { | |||||
log("lock attribute invalid - ignoring", Project.MSG_WARN); | log("lock attribute invalid - ignoring", Project.MSG_WARN); | ||||
} | } | ||||
@@ -136,7 +137,7 @@ public class P4Label extends P4Base { | |||||
Project.MSG_INFO); | Project.MSG_INFO); | ||||
//Now lock if required | //Now lock if required | ||||
if (lock != null && lock.equalsIgnoreCase("locked")) { | |||||
if (lock != null && lock.toLowerCase(Locale.ENGLISH).equals("locked")) { | |||||
log("Modifying lock status to 'locked'", Project.MSG_INFO); | log("Modifying lock status to 'locked'", Project.MSG_INFO); | ||||
@@ -28,6 +28,7 @@ import java.io.IOException; | |||||
import java.text.MessageFormat; | import java.text.MessageFormat; | ||||
import java.text.ParseException; | import java.text.ParseException; | ||||
import java.util.Enumeration; | import java.util.Enumeration; | ||||
import java.util.Locale; | |||||
import java.util.Random; | import java.util.Random; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
@@ -521,7 +522,7 @@ public class Pvcs extends org.apache.tools.ant.Task { | |||||
* @param f String (yes/no) | * @param f String (yes/no) | ||||
*/ | */ | ||||
public void setForce(String f) { | public void setForce(String f) { | ||||
if (f != null && f.equalsIgnoreCase("yes")) { | |||||
if (f != null && f.toLowerCase(Locale.ENGLISH).equals("yes")) { | |||||
force = "yes"; | force = "yes"; | ||||
} else { | } else { | ||||
force = "no"; | force = "no"; | ||||
@@ -110,7 +110,7 @@ public class ScriptDef extends DefBase { | |||||
* @param name the attribute name | * @param name the attribute name | ||||
*/ | */ | ||||
public void setName(String name) { | public void setName(String name) { | ||||
this.name = name.toLowerCase(Locale.US); | |||||
this.name = name.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
} | } | ||||
@@ -142,7 +142,7 @@ public class ScriptDef extends DefBase { | |||||
* @param name the name of this nested element | * @param name the name of this nested element | ||||
*/ | */ | ||||
public void setName(String name) { | public void setName(String name) { | ||||
this.name = name.toLowerCase(Locale.US); | |||||
this.name = name.toLowerCase(Locale.ENGLISH); | |||||
} | } | ||||
/** | /** | ||||
@@ -26,6 +26,7 @@ import java.text.ParseException; | |||||
import java.util.Calendar; | import java.util.Calendar; | ||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.GregorianCalendar; | import java.util.GregorianCalendar; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
@@ -515,9 +516,11 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
protected String getAutoresponse() { | protected String getAutoresponse() { | ||||
if (autoResponse == null) { | if (autoResponse == null) { | ||||
return FLAG_AUTORESPONSE_DEF; | return FLAG_AUTORESPONSE_DEF; | ||||
} else if (autoResponse.equalsIgnoreCase("Y")) { | |||||
} | |||||
autoResponse = autoResponse.toUpperCase(Locale.ENGLISH); | |||||
if (autoResponse.equals("Y")) { | |||||
return FLAG_AUTORESPONSE_YES; | return FLAG_AUTORESPONSE_YES; | ||||
} else if (autoResponse.equalsIgnoreCase("N")) { | |||||
} else if (autoResponse.equals("N")) { | |||||
return FLAG_AUTORESPONSE_NO; | return FLAG_AUTORESPONSE_NO; | ||||
} else { | } else { | ||||
return FLAG_AUTORESPONSE_DEF; | return FLAG_AUTORESPONSE_DEF; | ||||
@@ -18,6 +18,7 @@ | |||||
package org.apache.tools.ant.types; | package org.apache.tools.ant.types; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
/** | /** | ||||
@@ -150,4 +151,12 @@ public abstract class EnumeratedAttribute { | |||||
return getValue(); | 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)); | |||||
} | |||||
} | } |
@@ -597,7 +597,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
addExisting(systemBootClasspath); | addExisting(systemBootClasspath); | ||||
} | } | ||||
if (System.getProperty("java.vendor").toLowerCase(Locale.US).indexOf("microsoft") >= 0) { | |||||
if (System.getProperty("java.vendor").toLowerCase(Locale.ENGLISH).indexOf("microsoft") >= 0) { | |||||
// XXX is this code still necessary? is there any 1.2+ port? | // XXX is this code still necessary? is there any 1.2+ port? | ||||
// Pull in *.zip from packages directory | // Pull in *.zip from packages directory | ||||
FileSet msZipFiles = new FileSet(); | FileSet msZipFiles = new FileSet(); | ||||
@@ -22,6 +22,7 @@ import java.awt.BasicStroke; | |||||
import java.awt.Graphics2D; | import java.awt.Graphics2D; | ||||
import java.awt.geom.Arc2D; | import java.awt.geom.Arc2D; | ||||
import java.awt.image.BufferedImage; | import java.awt.image.BufferedImage; | ||||
import java.util.Locale; | |||||
/** | /** | ||||
* Draw an arc. | * Draw an arc. | ||||
@@ -73,11 +74,12 @@ public class Arc extends BasicShape implements DrawOperation { | |||||
* @todo refactor using an EnumeratedAttribute | * @todo refactor using an EnumeratedAttribute | ||||
*/ | */ | ||||
public void setType(String strType) { | public void setType(String strType) { | ||||
if (strType.toLowerCase().equals("open")) { | |||||
String stype = strType.toLowerCase(Locale.ENGLISH); | |||||
if (stype.equals("open")) { | |||||
type = Arc2D.OPEN; | type = Arc2D.OPEN; | ||||
} else if (strType.toLowerCase().equals("pie")) { | |||||
} else if (stype.equals("pie")) { | |||||
type = Arc2D.PIE; | type = Arc2D.PIE; | ||||
} else if (strType.toLowerCase().equals("chord")) { | |||||
} else if (stype.equals("chord")) { | |||||
type = Arc2D.CHORD; | type = Arc2D.CHORD; | ||||
} | } | ||||
} | } | ||||
@@ -18,6 +18,7 @@ | |||||
package org.apache.tools.ant.types.optional.image; | package org.apache.tools.ant.types.optional.image; | ||||
import java.awt.Color; | import java.awt.Color; | ||||
import java.util.Locale; | |||||
/** | /** | ||||
* | * | ||||
@@ -69,7 +70,7 @@ public final class ColorMapper { | |||||
* @todo refactor to use an EnumeratedAttribute (maybe?) | * @todo refactor to use an EnumeratedAttribute (maybe?) | ||||
*/ | */ | ||||
public static Color getColorByName(String colorName) { | public static Color getColorByName(String colorName) { | ||||
colorName = colorName.toLowerCase(); | |||||
colorName = colorName.toLowerCase(Locale.ENGLISH); | |||||
if (colorName.equals(COLOR_BLACK)) { | if (colorName.equals(COLOR_BLACK)) { | ||||
return Color.black; | return Color.black; | ||||
@@ -22,6 +22,7 @@ import java.io.BufferedReader; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.types.Parameter; | import org.apache.tools.ant.types.Parameter; | ||||
@@ -82,7 +83,9 @@ public class ContainsRegexpSelector extends BaseExtendSelector | |||||
if (parameters != null) { | if (parameters != null) { | ||||
for (int i = 0; i < parameters.length; i++) { | for (int i = 0; i < parameters.length; i++) { | ||||
String paramname = parameters[i].getName(); | String paramname = parameters[i].getName(); | ||||
if (EXPRESSION_KEY.equalsIgnoreCase(paramname)) { | |||||
if (paramname != null | |||||
&& EXPRESSION_KEY.equals(paramname | |||||
.toLowerCase(Locale.ENGLISH))) { | |||||
setExpression(parameters[i].getValue()); | setExpression(parameters[i].getValue()); | ||||
} else { | } else { | ||||
setError("Invalid parameter " + paramname); | setError("Invalid parameter " + paramname); | ||||
@@ -22,6 +22,7 @@ import java.io.BufferedReader; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
@@ -112,12 +113,15 @@ public class ContainsSelector extends BaseExtendSelector implements ResourceSele | |||||
if (parameters != null) { | if (parameters != null) { | ||||
for (int i = 0; i < parameters.length; i++) { | for (int i = 0; i < parameters.length; i++) { | ||||
String paramname = parameters[i].getName(); | String paramname = parameters[i].getName(); | ||||
if (CONTAINS_KEY.equalsIgnoreCase(paramname)) { | |||||
if (paramname != null) { | |||||
paramname = paramname.toLowerCase(Locale.ENGLISH); | |||||
} | |||||
if (CONTAINS_KEY.equals(paramname)) { | |||||
setText(parameters[i].getValue()); | setText(parameters[i].getValue()); | ||||
} else if (CASE_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (CASE_KEY.equals(paramname)) { | |||||
setCasesensitive(Project.toBoolean( | setCasesensitive(Project.toBoolean( | ||||
parameters[i].getValue())); | parameters[i].getValue())); | ||||
} else if (WHITESPACE_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (WHITESPACE_KEY.equals(paramname)) { | |||||
setIgnorewhitespace(Project.toBoolean( | setIgnorewhitespace(Project.toBoolean( | ||||
parameters[i].getValue())); | parameters[i].getValue())); | ||||
} else { | } else { | ||||
@@ -171,27 +171,30 @@ public class DateSelector extends BaseExtendSelector { | |||||
if (parameters != null) { | if (parameters != null) { | ||||
for (int i = 0; i < parameters.length; i++) { | for (int i = 0; i < parameters.length; i++) { | ||||
String paramname = parameters[i].getName(); | String paramname = parameters[i].getName(); | ||||
if (MILLIS_KEY.equalsIgnoreCase(paramname)) { | |||||
if (paramname != null) { | |||||
paramname = paramname.toLowerCase(Locale.ENGLISH); | |||||
} | |||||
if (MILLIS_KEY.equals(paramname)) { | |||||
try { | try { | ||||
setMillis(Long.parseLong(parameters[i].getValue())); | setMillis(Long.parseLong(parameters[i].getValue())); | ||||
} catch (NumberFormatException nfe) { | } catch (NumberFormatException nfe) { | ||||
setError("Invalid millisecond setting " | setError("Invalid millisecond setting " | ||||
+ parameters[i].getValue()); | + parameters[i].getValue()); | ||||
} | } | ||||
} else if (DATETIME_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (DATETIME_KEY.equals(paramname)) { | |||||
setDatetime(parameters[i].getValue()); | setDatetime(parameters[i].getValue()); | ||||
} else if (CHECKDIRS_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (CHECKDIRS_KEY.equals(paramname)) { | |||||
setCheckdirs(Project.toBoolean(parameters[i].getValue())); | setCheckdirs(Project.toBoolean(parameters[i].getValue())); | ||||
} else if (GRANULARITY_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (GRANULARITY_KEY.equals(paramname)) { | |||||
try { | try { | ||||
setGranularity(Integer.parseInt(parameters[i].getValue())); | setGranularity(Integer.parseInt(parameters[i].getValue())); | ||||
} catch (NumberFormatException nfe) { | } catch (NumberFormatException nfe) { | ||||
setError("Invalid granularity setting " | setError("Invalid granularity setting " | ||||
+ parameters[i].getValue()); | + parameters[i].getValue()); | ||||
} | } | ||||
} else if (WHEN_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (WHEN_KEY.equals(paramname)) { | |||||
setWhen(new TimeComparison(parameters[i].getValue())); | setWhen(new TimeComparison(parameters[i].getValue())); | ||||
} else if (PATTERN_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (PATTERN_KEY.equals(paramname)) { | |||||
setPattern(parameters[i].getValue()); | setPattern(parameters[i].getValue()); | ||||
} else { | } else { | ||||
setError("Invalid parameter " + paramname); | setError("Invalid parameter " + paramname); | ||||
@@ -19,6 +19,7 @@ | |||||
package org.apache.tools.ant.types.selectors; | package org.apache.tools.ant.types.selectors; | ||||
import java.io.File; | import java.io.File; | ||||
import java.util.Locale; | |||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
@@ -94,14 +95,17 @@ public class DepthSelector extends BaseExtendSelector { | |||||
if (parameters != null) { | if (parameters != null) { | ||||
for (int i = 0; i < parameters.length; i++) { | for (int i = 0; i < parameters.length; i++) { | ||||
String paramname = parameters[i].getName(); | String paramname = parameters[i].getName(); | ||||
if (MIN_KEY.equalsIgnoreCase(paramname)) { | |||||
if (paramname != null) { | |||||
paramname = paramname.toLowerCase(Locale.ENGLISH); | |||||
} | |||||
if (MIN_KEY.equals(paramname)) { | |||||
try { | try { | ||||
setMin(Integer.parseInt(parameters[i].getValue())); | setMin(Integer.parseInt(parameters[i].getValue())); | ||||
} catch (NumberFormatException nfe1) { | } catch (NumberFormatException nfe1) { | ||||
setError("Invalid minimum value " | setError("Invalid minimum value " | ||||
+ parameters[i].getValue()); | + parameters[i].getValue()); | ||||
} | } | ||||
} else if (MAX_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (MAX_KEY.equals(paramname)) { | |||||
try { | try { | ||||
setMax(Integer.parseInt(parameters[i].getValue())); | setMax(Integer.parseInt(parameters[i].getValue())); | ||||
} catch (NumberFormatException nfe1) { | } catch (NumberFormatException nfe1) { | ||||
@@ -19,6 +19,7 @@ | |||||
package org.apache.tools.ant.types.selectors; | package org.apache.tools.ant.types.selectors; | ||||
import java.io.File; | import java.io.File; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.types.Parameter; | import org.apache.tools.ant.types.Parameter; | ||||
@@ -133,14 +134,17 @@ public class FilenameSelector extends BaseExtendSelector { | |||||
if (parameters != null) { | if (parameters != null) { | ||||
for (int i = 0; i < parameters.length; i++) { | for (int i = 0; i < parameters.length; i++) { | ||||
String paramname = parameters[i].getName(); | String paramname = parameters[i].getName(); | ||||
if (NAME_KEY.equalsIgnoreCase(paramname)) { | |||||
if (paramname != null) { | |||||
paramname = paramname.toLowerCase(Locale.ENGLISH); | |||||
} | |||||
if (NAME_KEY.equals(paramname)) { | |||||
setName(parameters[i].getValue()); | setName(parameters[i].getValue()); | ||||
} else if (CASE_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (CASE_KEY.equals(paramname)) { | |||||
setCasesensitive(Project.toBoolean( | setCasesensitive(Project.toBoolean( | ||||
parameters[i].getValue())); | parameters[i].getValue())); | ||||
} else if (NEGATE_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (NEGATE_KEY.equals(paramname)) { | |||||
setNegate(Project.toBoolean(parameters[i].getValue())); | setNegate(Project.toBoolean(parameters[i].getValue())); | ||||
} else if (REGEX_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (REGEX_KEY.equals(paramname)) { | |||||
setRegex(parameters[i].getValue()); | setRegex(parameters[i].getValue()); | ||||
} else { | } else { | ||||
setError("Invalid parameter " + paramname); | setError("Invalid parameter " + paramname); | ||||
@@ -19,6 +19,7 @@ | |||||
package org.apache.tools.ant.types.selectors; | package org.apache.tools.ant.types.selectors; | ||||
import java.io.File; | import java.io.File; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.types.Comparison; | import org.apache.tools.ant.types.Comparison; | ||||
import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
@@ -169,18 +170,21 @@ public class SizeSelector extends BaseExtendSelector { | |||||
if (parameters != null) { | if (parameters != null) { | ||||
for (int i = 0; i < parameters.length; i++) { | for (int i = 0; i < parameters.length; i++) { | ||||
String paramname = parameters[i].getName(); | String paramname = parameters[i].getName(); | ||||
if (SIZE_KEY.equalsIgnoreCase(paramname)) { | |||||
if (paramname != null) { | |||||
paramname = paramname.toLowerCase(Locale.ENGLISH); | |||||
} | |||||
if (SIZE_KEY.equals(paramname)) { | |||||
try { | try { | ||||
setValue(Long.parseLong(parameters[i].getValue())); | setValue(Long.parseLong(parameters[i].getValue())); | ||||
} catch (NumberFormatException nfe) { | } catch (NumberFormatException nfe) { | ||||
setError("Invalid size setting " | setError("Invalid size setting " | ||||
+ parameters[i].getValue()); | + parameters[i].getValue()); | ||||
} | } | ||||
} else if (UNITS_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (UNITS_KEY.equals(paramname)) { | |||||
ByteUnits units = new ByteUnits(); | ByteUnits units = new ByteUnits(); | ||||
units.setValue(parameters[i].getValue()); | units.setValue(parameters[i].getValue()); | ||||
setUnits(units); | setUnits(units); | ||||
} else if (WHEN_KEY.equalsIgnoreCase(paramname)) { | |||||
} else if (WHEN_KEY.equals(paramname)) { | |||||
SizeComparisons scmp = new SizeComparisons(); | SizeComparisons scmp = new SizeComparisons(); | ||||
scmp.setValue(parameters[i].getValue()); | scmp.setValue(parameters[i].getValue()); | ||||
setWhen(scmp); | setWhen(scmp); | ||||
@@ -19,6 +19,7 @@ | |||||
package org.apache.tools.ant.types.selectors; | package org.apache.tools.ant.types.selectors; | ||||
import java.io.File; | import java.io.File; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
import org.apache.tools.ant.types.Parameter; | import org.apache.tools.ant.types.Parameter; | ||||
@@ -71,7 +72,10 @@ public class TypeSelector extends BaseExtendSelector { | |||||
if (parameters != null) { | if (parameters != null) { | ||||
for (int i = 0; i < parameters.length; i++) { | for (int i = 0; i < parameters.length; i++) { | ||||
String paramname = parameters[i].getName(); | String paramname = parameters[i].getName(); | ||||
if (TYPE_KEY.equalsIgnoreCase(paramname)) { | |||||
if (paramname != null) { | |||||
paramname = paramname.toLowerCase(Locale.ENGLISH); | |||||
} | |||||
if (TYPE_KEY.equals(paramname)) { | |||||
FileType t = new FileType(); | FileType t = new FileType(); | ||||
t.setValue(parameters[i].getValue()); | t.setValue(parameters[i].getValue()); | ||||
setType(t); | setType(t); | ||||
@@ -18,7 +18,7 @@ | |||||
package org.apache.tools.ant.types.selectors.modifiedselector; | package org.apache.tools.ant.types.selectors.modifiedselector; | ||||
import java.util.Locale; | |||||
import java.util.zip.Checksum; | import java.util.zip.Checksum; | ||||
import java.util.zip.CRC32; | import java.util.zip.CRC32; | ||||
import java.util.zip.Adler32; | import java.util.zip.Adler32; | ||||
@@ -76,7 +76,8 @@ public class ChecksumAlgorithm implements Algorithm { | |||||
* @param algorithm the digest algorithm to use | * @param algorithm the digest algorithm to use | ||||
*/ | */ | ||||
public void setAlgorithm(String algorithm) { | public void setAlgorithm(String algorithm) { | ||||
this.algorithm = algorithm; | |||||
this.algorithm = | |||||
algorithm != null ? algorithm.toUpperCase(Locale.ENGLISH) : null; | |||||
} | } | ||||
@@ -85,9 +86,9 @@ public class ChecksumAlgorithm implements Algorithm { | |||||
if (checksum != null) { | if (checksum != null) { | ||||
return; | return; | ||||
} | } | ||||
if ("CRC".equalsIgnoreCase(algorithm)) { | |||||
if ("CRC".equals(algorithm)) { | |||||
checksum = new CRC32(); | checksum = new CRC32(); | ||||
} else if ("ADLER".equalsIgnoreCase(algorithm)) { | |||||
} else if ("ADLER".equals(algorithm)) { | |||||
checksum = new Adler32(); | checksum = new Adler32(); | ||||
} else { | } else { | ||||
throw new BuildException(new NoSuchAlgorithmException()); | throw new BuildException(new NoSuchAlgorithmException()); | ||||
@@ -103,7 +104,7 @@ public class ChecksumAlgorithm implements Algorithm { | |||||
* @return <i>true</i> if all is ok, otherwise <i>false</i>. | * @return <i>true</i> if all is ok, otherwise <i>false</i>. | ||||
*/ | */ | ||||
public boolean isValid() { | public boolean isValid() { | ||||
return "CRC".equalsIgnoreCase(algorithm) || "ADLER".equalsIgnoreCase(algorithm); | |||||
return "CRC".equals(algorithm) || "ADLER".equals(algorithm); | |||||
} | } | ||||
@@ -21,6 +21,7 @@ package org.apache.tools.ant.types.selectors.modifiedselector; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
import java.util.Locale; | |||||
import java.security.DigestInputStream; | import java.security.DigestInputStream; | ||||
import java.security.MessageDigest; | import java.security.MessageDigest; | ||||
import java.security.NoSuchAlgorithmException; | import java.security.NoSuchAlgorithmException; | ||||
@@ -92,7 +93,8 @@ public class DigestAlgorithm implements Algorithm { | |||||
* @param algorithm the digest algorithm to use | * @param algorithm the digest algorithm to use | ||||
*/ | */ | ||||
public void setAlgorithm(String algorithm) { | public void setAlgorithm(String algorithm) { | ||||
this.algorithm = algorithm; | |||||
this.algorithm = algorithm != null | |||||
? algorithm.toUpperCase(Locale.ENGLISH) : null; | |||||
} | } | ||||
@@ -138,7 +140,7 @@ public class DigestAlgorithm implements Algorithm { | |||||
* @return <i>true</i> if all is ok, otherwise <i>false</i>. | * @return <i>true</i> if all is ok, otherwise <i>false</i>. | ||||
*/ | */ | ||||
public boolean isValid() { | public boolean isValid() { | ||||
return "SHA".equalsIgnoreCase(algorithm) || "MD5".equalsIgnoreCase(algorithm); | |||||
return "SHA".equals(algorithm) || "MD5".equals(algorithm); | |||||
} | } | ||||
@@ -20,10 +20,11 @@ package org.apache.tools.ant.types.selectors.modifiedselector; | |||||
// Java | // Java | ||||
import java.io.File; | |||||
import java.util.Comparator; | import java.util.Comparator; | ||||
import java.util.Vector; | |||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.io.File; | |||||
import java.util.Locale; | |||||
import java.util.Vector; | |||||
// Ant | // Ant | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
@@ -720,6 +721,8 @@ public class ModifiedSelector extends BaseExtendSelector | |||||
public void useParameter(Parameter parameter) { | public void useParameter(Parameter parameter) { | ||||
String key = parameter.getName(); | String key = parameter.getName(); | ||||
String value = parameter.getValue(); | String value = parameter.getValue(); | ||||
String valueLC = | |||||
value != null ? value.toLowerCase(Locale.ENGLISH) : null; | |||||
if ("cache".equals(key)) { | if ("cache".equals(key)) { | ||||
CacheName cn = new CacheName(); | CacheName cn = new CacheName(); | ||||
cn.setValue(value); | cn.setValue(value); | ||||
@@ -734,19 +737,19 @@ public class ModifiedSelector extends BaseExtendSelector | |||||
setComparator(cn); | setComparator(cn); | ||||
} else if ("update".equals(key)) { | } else if ("update".equals(key)) { | ||||
boolean updateValue = | boolean updateValue = | ||||
("true".equalsIgnoreCase(value)) | |||||
("true".equals(valueLC)) | |||||
? true | ? true | ||||
: false; | : false; | ||||
setUpdate(updateValue); | setUpdate(updateValue); | ||||
} else if ("delayupdate".equals(key)) { | } else if ("delayupdate".equals(key)) { | ||||
boolean updateValue = | boolean updateValue = | ||||
("true".equalsIgnoreCase(value)) | |||||
("true".equals(valueLC)) | |||||
? true | ? true | ||||
: false; | : false; | ||||
setDelayUpdate(updateValue); | setDelayUpdate(updateValue); | ||||
} else if ("seldirs".equals(key)) { | } else if ("seldirs".equals(key)) { | ||||
boolean sdValue = | boolean sdValue = | ||||
("true".equalsIgnoreCase(value)) | |||||
("true".equals(valueLC)) | |||||
? true | ? true | ||||
: false; | : false; | ||||
setSeldirs(sdValue); | setSeldirs(sdValue); | ||||
@@ -21,6 +21,7 @@ package org.apache.tools.ant.util; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.PipedInputStream; | import java.io.PipedInputStream; | ||||
import java.io.PipedOutputStream; | import java.io.PipedOutputStream; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.ProjectComponent; | import org.apache.tools.ant.ProjectComponent; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
@@ -86,7 +87,11 @@ public class LeadPipeInputStream extends PipedInputStream { | |||||
try { | try { | ||||
result = super.read(); | result = super.read(); | ||||
} catch (IOException eyeOhEx) { | } catch (IOException eyeOhEx) { | ||||
if ("write end dead".equalsIgnoreCase(eyeOhEx.getMessage())) { | |||||
String msg = eyeOhEx.getMessage(); | |||||
if (msg != null) { | |||||
msg = msg.toLowerCase(Locale.ENGLISH); | |||||
} | |||||
if ("write end dead".equals(msg)) { | |||||
if (super.in > 0 && super.out < super.buffer.length | if (super.in > 0 && super.out < super.buffer.length | ||||
&& super.out > super.in) { | && super.out > super.in) { | ||||
result = super.buffer[super.out++] & BYTE_MASK; | result = super.buffer[super.out++] & BYTE_MASK; | ||||
@@ -20,8 +20,8 @@ package org.apache.tools.ant.util.optional; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.Locale; | |||||
import org.apache.tools.ant.util.ScriptRunnerBase; | import org.apache.tools.ant.util.ScriptRunnerBase; | ||||
import org.apache.tools.ant.util.ReflectUtil; | import org.apache.tools.ant.util.ReflectUtil; | ||||
import org.apache.tools.ant.util.ReflectWrapper; | import org.apache.tools.ant.util.ReflectWrapper; | ||||
@@ -90,7 +90,7 @@ public class JavaxScriptRunner extends ScriptRunnerBase { | |||||
for (Iterator i = getBeans().keySet().iterator(); i.hasNext();) { | for (Iterator i = getBeans().keySet().iterator(); i.hasNext();) { | ||||
String key = (String) i.next(); | String key = (String) i.next(); | ||||
Object value = getBeans().get(key); | Object value = getBeans().get(key); | ||||
if ("FX".equalsIgnoreCase(getLanguage())) { | |||||
if ("FX".equals(getLanguage().toUpperCase(Locale.ENGLISH))) { | |||||
engine.invoke( | engine.invoke( | ||||
"put", String.class, key | "put", String.class, key | ||||
+ ":" + value.getClass().getName(), | + ":" + value.getClass().getName(), | ||||
@@ -625,7 +625,7 @@ public class TarEntry implements TarConstants { | |||||
*/ | */ | ||||
private static String normalizeFileName(String fileName, | private static String normalizeFileName(String fileName, | ||||
boolean preserveLeadingSlashes) { | boolean preserveLeadingSlashes) { | ||||
String osname = System.getProperty("os.name").toLowerCase(Locale.US); | |||||
String osname = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); | |||||
if (osname != null) { | if (osname != null) { | ||||