Browse Source

As Jesse points out, equalsIgnoreCase is not locale-sensitive

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@911324 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 15 years ago
parent
commit
c767541c7d
45 changed files with 183 additions and 270 deletions
  1. +1
    -2
      src/main/org/apache/tools/ant/AntClassLoader.java
  2. +3
    -5
      src/main/org/apache/tools/ant/Project.java
  3. +0
    -4
      src/main/org/apache/tools/ant/ProjectHelper.java
  4. +4
    -5
      src/main/org/apache/tools/ant/PropertyHelper.java
  5. +2
    -4
      src/main/org/apache/tools/ant/RuntimeConfigurable.java
  6. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Available.java
  7. +1
    -5
      src/main/org/apache/tools/ant/taskdefs/Ear.java
  8. +4
    -8
      src/main/org/apache/tools/ant/taskdefs/EchoXML.java
  9. +6
    -9
      src/main/org/apache/tools/ant/taskdefs/Jar.java
  10. +14
    -21
      src/main/org/apache/tools/ant/taskdefs/Javac.java
  11. +2
    -5
      src/main/org/apache/tools/ant/taskdefs/Manifest.java
  12. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/Recorder.java
  13. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  14. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/Tar.java
  15. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/Touch.java
  16. +1
    -6
      src/main/org/apache/tools/ant/taskdefs/War.java
  17. +4
    -9
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  18. +17
    -19
      src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
  19. +1
    -3
      src/main/org/apache/tools/ant/taskdefs/condition/IsLastModified.java
  20. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
  21. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java
  22. +2
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java
  23. +2
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  24. +1
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  25. +1
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java
  26. +3
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
  27. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java
  28. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  29. +2
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  30. +8
    -14
      src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
  31. +0
    -9
      src/main/org/apache/tools/ant/types/EnumeratedAttribute.java
  32. +3
    -5
      src/main/org/apache/tools/ant/types/optional/image/Arc.java
  33. +13
    -16
      src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java
  34. +1
    -4
      src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java
  35. +3
    -7
      src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java
  36. +6
    -9
      src/main/org/apache/tools/ant/types/selectors/DateSelector.java
  37. +2
    -6
      src/main/org/apache/tools/ant/types/selectors/DepthSelector.java
  38. +4
    -8
      src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java
  39. +3
    -7
      src/main/org/apache/tools/ant/types/selectors/SizeSelector.java
  40. +1
    -5
      src/main/org/apache/tools/ant/types/selectors/TypeSelector.java
  41. +3
    -6
      src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
  42. +3
    -7
      src/main/org/apache/tools/ant/util/LeadPipeInputStream.java
  43. +1
    -2
      src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
  44. +3
    -8
      src/main/org/apache/tools/zip/ZipEncodingHelper.java
  45. +42
    -0
      src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java

+ 1
- 2
src/main/org/apache/tools/ant/AntClassLoader.java View File

@@ -37,7 +37,6 @@ import java.util.Hashtable;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Vector; import java.util.Vector;
import java.util.Locale;
import java.util.jar.Attributes; import java.util.jar.Attributes;
import java.util.jar.Attributes.Name; import java.util.jar.Attributes.Name;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
@@ -1280,7 +1279,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
sealedString = mainAttributes.getValue(Name.SEALED); sealedString = mainAttributes.getValue(Name.SEALED);
} }
} }
if (sealedString != null && sealedString.toLowerCase(Locale.ENGLISH).equals("true")) {
if (sealedString != null && sealedString.equalsIgnoreCase("true")) {
try { try {
sealBase = new URL(FileUtils.getFileUtils().toURI(container.getAbsolutePath())); sealBase = new URL(FileUtils.getFileUtils().toURI(container.getAbsolutePath()));
} catch (MalformedURLException e) { } catch (MalformedURLException e) {


+ 3
- 5
src/main/org/apache/tools/ant/Project.java View File

@@ -32,7 +32,6 @@ 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;
@@ -1715,10 +1714,9 @@ 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) {
String lc = s == null ? null : s.toLowerCase(Locale.ENGLISH);
return ("on".equals(lc)
|| "true".equals(lc)
|| "yes".equals(lc));
return ("on".equalsIgnoreCase(s)
|| "true".equalsIgnoreCase(s)
|| "yes".equalsIgnoreCase(s));
} }


/** /**


+ 0
- 4
src/main/org/apache/tools/ant/ProjectHelper.java View File

@@ -47,10 +47,6 @@ 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 comparisons */
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.


+ 4
- 5
src/main/org/apache/tools/ant/PropertyHelper.java View File

@@ -24,7 +24,6 @@ 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;
@@ -1146,13 +1145,13 @@ public class PropertyHelper implements GetProperty {
return (Boolean) value; return (Boolean) value;
} }
if (value instanceof String) { if (value instanceof String) {
String s = ((String) value).toLowerCase(Locale.ENGLISH);
String s = (String) value;
if (Project.toBoolean(s)) { if (Project.toBoolean(s)) {
return Boolean.TRUE; return Boolean.TRUE;
} }
if ("off".equals(s)
|| "false".equals(s)
|| "no".equals(s)) {
if ("off".equalsIgnoreCase(s)
|| "false".equalsIgnoreCase(s)
|| "no".equalsIgnoreCase(s)) {
return Boolean.FALSE; return Boolean.FALSE;
} }
} }


+ 2
- 4
src/main/org/apache/tools/ant/RuntimeConfigurable.java View File

@@ -25,7 +25,6 @@ import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Iterator; import java.util.Iterator;


@@ -185,15 +184,14 @@ 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) {
String nameLC = name.toLowerCase(Locale.ENGLISH);
if (nameLC.equals(ProjectHelper.ANT_TYPE_LC)) {
if (name.equalsIgnoreCase(ProjectHelper.ANT_TYPE)) {
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 (nameLC.equals("refid")) {
if (name.equalsIgnoreCase("refid")) {
attributeNames.add(0, name); attributeNames.add(0, name);
} else { } else {
attributeNames.add(name); attributeNames.add(name);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Available.java View File

@@ -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 equalsIgnoreCase("dir", getValue());
return "dir".equalsIgnoreCase(getValue());
} }


/** /**
@@ -510,7 +510,7 @@ public class Available extends Task implements Condition {
* @return true if the value specifies a file. * @return true if the value specifies a file.
*/ */
public boolean isFile() { public boolean isFile() {
return equalsIgnoreCase("file", getValue());
return "file".equalsIgnoreCase(getValue());
} }


} }


+ 1
- 5
src/main/org/apache/tools/ant/taskdefs/Ear.java View File

@@ -19,7 +19,6 @@ package org.apache.tools.ant.taskdefs;


import java.io.File; import java.io.File;
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;
@@ -40,8 +39,6 @@ public class Ear extends Jar {
private File deploymentDescriptor; private File deploymentDescriptor;
private boolean descriptorAdded; private boolean descriptorAdded;
private static final String XML_DESCRIPTOR_PATH = "META-INF/application.xml"; private static final String XML_DESCRIPTOR_PATH = "META-INF/application.xml";
private static final String XML_DESCRIPTOR_PATH_LC =
XML_DESCRIPTOR_PATH.toLowerCase(Locale.ENGLISH);


/** /**
* Create an Ear task. * Create an Ear task.
@@ -127,8 +124,7 @@ public class Ear extends Jar {
// attribute - or if it's being added twice, meaning the same // attribute - or if it's being added twice, meaning the same
// file is specified by the "appxml" attribute and in a // file is specified by the "appxml" attribute and in a
// <fileset> element. // <fileset> element.
String vPathLowerCase = vPath.toLowerCase(Locale.ENGLISH);
if (XML_DESCRIPTOR_PATH_LC.equals(vPathLowerCase)) {
if (XML_DESCRIPTOR_PATH.equalsIgnoreCase(vPath)) {
if (deploymentDescriptor == null if (deploymentDescriptor == null
|| !FILE_UTILS.fileNameEquals(deploymentDescriptor, file) || !FILE_UTILS.fileNameEquals(deploymentDescriptor, file)
|| descriptorAdded) { || descriptorAdded) {


+ 4
- 8
src/main/org/apache/tools/ant/taskdefs/EchoXML.java View File

@@ -20,7 +20,6 @@ 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;
@@ -106,8 +105,6 @@ 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
@@ -124,14 +121,13 @@ public class EchoXML extends XMLFragment {
} }


public DOMElementWriter.XmlNamespacePolicy getPolicy() { public DOMElementWriter.XmlNamespacePolicy getPolicy() {
String v = getValue();
String s = v != null ? v.toLowerCase(Locale.ENGLISH) : null;
if (IGNORE.equals(s)) {
String s = getValue();
if (IGNORE.equalsIgnoreCase(s)) {
return DOMElementWriter.XmlNamespacePolicy.IGNORE; return DOMElementWriter.XmlNamespacePolicy.IGNORE;
} else if (ELEMENTS_LC.equals(s)) {
} else if (ELEMENTS.equalsIgnoreCase(s)) {
return return
DOMElementWriter.XmlNamespacePolicy.ONLY_QUALIFY_ELEMENTS; DOMElementWriter.XmlNamespacePolicy.ONLY_QUALIFY_ELEMENTS;
} else if (ALL.equals(s)) {
} else if (ALL.equalsIgnoreCase(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);


+ 6
- 9
src/main/org/apache/tools/ant/taskdefs/Jar.java View File

@@ -37,7 +37,6 @@ 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;
@@ -342,7 +341,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().toUpperCase(Locale.ENGLISH).equals(MANIFEST_NAME)) {
if (ze.getName().equalsIgnoreCase(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);
@@ -383,7 +382,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().toUpperCase(Locale.ENGLISH).equals(INDEX_NAME)) {
if (ze.getName().equalsIgnoreCase(INDEX_NAME)) {
return true; return true;
} }
} }
@@ -693,12 +692,11 @@ 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 {
String vPathUC = vPath != null ? vPath.toUpperCase(Locale.ENGLISH) : null;
if (MANIFEST_NAME.equals(vPathUC)) {
if (MANIFEST_NAME.equalsIgnoreCase(vPath)) {
if (isFirstPass()) { if (isFirstPass()) {
filesetManifest(fromArchive, is); filesetManifest(fromArchive, is);
} }
} else if (INDEX_NAME.equals(vPathUC) && index) {
} else if (INDEX_NAME.equalsIgnoreCase(vPath) && 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.",
@@ -967,7 +965,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().toLowerCase(Locale.ENGLISH).equals("fail")) {
if (strict.getValue().equalsIgnoreCase("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());
@@ -1169,8 +1167,7 @@ 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().toUpperCase(Locale.ENGLISH)
.equals(MANIFEST_NAME)) {
if (resources[0][j].getName().equalsIgnoreCase(MANIFEST_NAME)) {
manifests[i] = new Resource[] {resources[0][j]}; manifests[i] = new Resource[] {resources[0][j]};
break; break;
} }


+ 14
- 21
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -24,7 +24,6 @@ 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;
@@ -89,8 +88,6 @@ 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();


@@ -682,9 +679,7 @@ 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() {
String c = getCompiler();
return fork ||
(c != null && EXTJAVAC_LC.equals(c.toLowerCase(Locale.ENGLISH)));
return fork || EXTJAVAC.equalsIgnoreCase(getCompiler());
} }


/** /**
@@ -763,31 +758,29 @@ public class Javac extends MatchingTask {
} }


private String getAltCompilerName(String anImplementation) { private String getAltCompilerName(String anImplementation) {
anImplementation = anImplementation != null
? anImplementation.toLowerCase(Locale.ENGLISH) : null;
if (JAVAC16.equals(anImplementation)
|| JAVAC15.equals(anImplementation)
|| JAVAC14.equals(anImplementation)
|| JAVAC13.equals(anImplementation)) {
if (JAVAC16.equalsIgnoreCase(anImplementation)
|| JAVAC15.equalsIgnoreCase(anImplementation)
|| JAVAC14.equalsIgnoreCase(anImplementation)
|| JAVAC13.equalsIgnoreCase(anImplementation)) {
return MODERN; return MODERN;
} }
if (JAVAC12.equals(anImplementation)
|| JAVAC11.equals(anImplementation)) {
if (JAVAC12.equalsIgnoreCase(anImplementation)
|| JAVAC11.equalsIgnoreCase(anImplementation)) {
return CLASSIC; return CLASSIC;
} }
if (MODERN.equals(anImplementation)) {
if (MODERN.equalsIgnoreCase(anImplementation)) {
String nextSelected = assumedJavaVersion(); String nextSelected = assumedJavaVersion();
if (JAVAC16.equals(nextSelected)
|| JAVAC15.equals(nextSelected)
|| JAVAC14.equals(nextSelected)
|| JAVAC13.equals(nextSelected)) {
if (JAVAC16.equalsIgnoreCase(nextSelected)
|| JAVAC15.equalsIgnoreCase(nextSelected)
|| JAVAC14.equalsIgnoreCase(nextSelected)
|| JAVAC13.equalsIgnoreCase(nextSelected)) {
return nextSelected; return nextSelected;
} }
} }
if (CLASSIC.equals(anImplementation)) {
if (CLASSIC.equalsIgnoreCase(anImplementation)) {
return assumedJavaVersion(); return assumedJavaVersion();
} }
if (EXTJAVAC_LC.equals(anImplementation)) {
if (EXTJAVAC.equalsIgnoreCase(anImplementation)) {
return assumedJavaVersion(); return assumedJavaVersion();
} }
return null; return null;


+ 2
- 5
src/main/org/apache/tools/ant/taskdefs/Manifest.java View File

@@ -513,10 +513,8 @@ 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 (attributeNameLC.equals(ATTRIBUTE_CLASSPATH_LC)) {
if (attributeName.equalsIgnoreCase(ATTRIBUTE_CLASSPATH)) {
if (classpathAttribute == null) { if (classpathAttribute == null) {
classpathAttribute = new Attribute(); classpathAttribute = new Attribute();
classpathAttribute.setName(ATTRIBUTE_CLASSPATH); classpathAttribute.setName(ATTRIBUTE_CLASSPATH);
@@ -870,8 +868,7 @@ 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().toLowerCase(Locale.ENGLISH)
.equals(ATTRIBUTE_NAME_LC)) {
if (!sectionName.getName().equalsIgnoreCase(ATTRIBUTE_NAME)) {
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 \""


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/Recorder.java View File

@@ -19,7 +19,6 @@ 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;
@@ -102,7 +101,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().toLowerCase(Locale.ENGLISH).equals("start")) {
if (action.getValue().equalsIgnoreCase("start")) {
start = Boolean.TRUE; start = Boolean.TRUE;
} else { } else {
start = Boolean.FALSE; start = Boolean.FALSE;


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -726,8 +726,7 @@ 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 (token != null
&& "REM".equals(token.toUpperCase(Locale.ENGLISH))) {
if ("REM".equalsIgnoreCase(token)) {
continue; continue;
} }
} }


+ 5
- 5
src/main/org/apache/tools/ant/taskdefs/Tar.java View File

@@ -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 equalsIgnoreCase(TRUNCATE, getValue());
return TRUNCATE.equalsIgnoreCase(getValue());
} }


/** /**
* @return true if value is "warn". * @return true if value is "warn".
*/ */
public boolean isWarnMode() { public boolean isWarnMode() {
return equalsIgnoreCase(WARN, getValue());
return WARN.equalsIgnoreCase(getValue());
} }


/** /**
* @return true if value is "gnu". * @return true if value is "gnu".
*/ */
public boolean isGnuMode() { public boolean isGnuMode() {
return equalsIgnoreCase(GNU, getValue());
return GNU.equalsIgnoreCase(getValue());
} }


/** /**
* @return true if value is "fail". * @return true if value is "fail".
*/ */
public boolean isFailMode() { public boolean isFailMode() {
return equalsIgnoreCase(FAIL, getValue());
return FAIL.equalsIgnoreCase(getValue());
} }


/** /**
* @return true if value is "omit". * @return true if value is "omit".
*/ */
public boolean isOmitMode() { public boolean isOmitMode() {
return equalsIgnoreCase(OMIT, getValue());
return OMIT.equalsIgnoreCase(getValue());
} }
} }




+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/Touch.java View File

@@ -233,8 +233,7 @@ public class Touch extends Task {
} }
if (dateTime != null && !dateTimeConfigured) { if (dateTime != null && !dateTimeConfigured) {
long workmillis = millis; long workmillis = millis;
if (dateTime != null
&& "now".equals(dateTime.toLowerCase(Locale.ENGLISH))) {
if ("now".equalsIgnoreCase(dateTime)) {
workmillis = System.currentTimeMillis(); workmillis = System.currentTimeMillis();
} else { } else {
DateFormat df = dfFactory.getPrimaryFormat(); DateFormat df = dfFactory.getPrimaryFormat();


+ 1
- 6
src/main/org/apache/tools/ant/taskdefs/War.java View File

@@ -20,7 +20,6 @@ package org.apache.tools.ant.taskdefs;


import java.io.File; import java.io.File;
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;
import org.apache.tools.ant.types.ZipFileSet; import org.apache.tools.ant.types.ZipFileSet;
@@ -61,9 +60,6 @@ public class War extends Jar {
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
/** path to web.xml file */ /** path to web.xml file */
private static final String XML_DESCRIPTOR_PATH = "WEB-INF/web.xml"; private static final String XML_DESCRIPTOR_PATH = "WEB-INF/web.xml";
/** lower case version for comparisons */
private static final String XML_DESCRIPTOR_PATH_LC =
XML_DESCRIPTOR_PATH.toLowerCase(Locale.ENGLISH);


/** Constructor for the War Task. */ /** Constructor for the War Task. */
public War() { public War() {
@@ -178,10 +174,9 @@ public class War extends Jar {
// not the one specified in the "webxml" attribute - or if // not the one specified in the "webxml" attribute - or if
// it's being added twice, meaning the same file is specified // it's being added twice, meaning the same file is specified
// by the "webxml" attribute and in a <fileset> element. // by the "webxml" attribute and in a <fileset> element.
String vPathLowerCase = vPath.toLowerCase(Locale.ENGLISH);
//by default, we add the file. //by default, we add the file.
boolean addFile = true; boolean addFile = true;
if (XML_DESCRIPTOR_PATH_LC.equals(vPathLowerCase)) {
if (XML_DESCRIPTOR_PATH.equalsIgnoreCase(vPath)) {
//a web.xml file was found. See if it is a duplicate or not //a web.xml file was found. See if it is a duplicate or not
if (addedWebXmlFile != null) { if (addedWebXmlFile != null) {
//a second web.xml file, so skip it //a second web.xml file, so skip it


+ 4
- 9
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java View File

@@ -20,7 +20,6 @@ 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;
@@ -1367,18 +1366,14 @@ 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.
String nameLC = name != null
? name.toLowerCase(Locale.ENGLISH) : null;
if ("name".equals(nameLC)) {
if ("name".equalsIgnoreCase(name)) {
this.name = value; this.name = value;
} else if ("value".equals(nameLC)) {
} else if ("value".equalsIgnoreCase(name)) {
// 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.
String valueLC = value != null
? value.toLowerCase(Locale.ENGLISH) : null;
if ("true".equals(valueLC)) {
if ("true".equalsIgnoreCase(value)) {
this.value = Boolean.TRUE; this.value = Boolean.TRUE;
} else if ("false".equals(valueLC)) {
} else if ("false".equalsIgnoreCase(value)) {
this.value = Boolean.FALSE; this.value = Boolean.FALSE;
} else { } else {
try { try {


+ 17
- 19
src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java View File

@@ -18,7 +18,6 @@


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;
@@ -99,29 +98,28 @@ 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 {
String compilerTypeLC = compilerType.toLowerCase(Locale.ENGLISH);
if (compilerTypeLC.equals("jikes")) {
if (compilerType.equalsIgnoreCase("jikes")) {
return new Jikes(); return new Jikes();
} }
if (compilerTypeLC.equals("extjavac")) {
if (compilerType.equalsIgnoreCase("extjavac")) {
return new JavacExternal(); return new JavacExternal();
} }
if (compilerTypeLC.equals("classic")
|| compilerTypeLC.equals("javac1.1")
|| compilerTypeLC.equals("javac1.2")) {
if (compilerType.equalsIgnoreCase("classic")
|| compilerType.equalsIgnoreCase("javac1.1")
|| compilerType.equalsIgnoreCase("javac1.2")) {
task.log("This version of java does " 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);
compilerTypeLC = "modern";
compilerType = "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 (compilerTypeLC.equals("modern")
|| compilerTypeLC.equals("javac1.3")
|| compilerTypeLC.equals("javac1.4")
|| compilerTypeLC.equals("javac1.5")
|| compilerTypeLC.equals("javac1.6")) {
if (compilerType.equalsIgnoreCase("modern")
|| compilerType.equalsIgnoreCase("javac1.3")
|| compilerType.equalsIgnoreCase("javac1.4")
|| compilerType.equalsIgnoreCase("javac1.5")
|| compilerType.equalsIgnoreCase("javac1.6")) {
// does the modern compiler exist? // does the modern compiler exist?
if (doesModernCompilerExist()) { if (doesModernCompilerExist()) {
return new Javac13(); return new Javac13();
@@ -139,18 +137,18 @@ public final class CompilerAdapterFactory {
} }
} }


if (compilerTypeLC.equals("jvc")
|| compilerTypeLC.equals("microsoft")) {
if (compilerType.equalsIgnoreCase("jvc")
|| compilerType.equalsIgnoreCase("microsoft")) {
return new Jvc(); return new Jvc();
} }
if (compilerTypeLC.equals("kjc")) {
if (compilerType.equalsIgnoreCase("kjc")) {
return new Kjc(); return new Kjc();
} }
if (compilerTypeLC.equals("gcj")) {
if (compilerType.equalsIgnoreCase("gcj")) {
return new Gcj(); return new Gcj();
} }
if (compilerTypeLC.equals("sj")
|| compilerTypeLC.equals("symantec")) {
if (compilerType.equalsIgnoreCase("sj")
|| compilerType.equalsIgnoreCase("symantec")) {
return new Sj(); return new Sj();
} }
return resolveClassName(compilerType, return resolveClassName(compilerType,


+ 1
- 3
src/main/org/apache/tools/ant/taskdefs/condition/IsLastModified.java View File

@@ -22,7 +22,6 @@ 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;
@@ -120,8 +119,7 @@ public class IsLastModified extends ProjectComponent implements Condition {
if (millis >= 0) { if (millis >= 0) {
return millis; return millis;
} }
if (dateTime != null
&& "now".equals(dateTime.toLowerCase(Locale.ENGLISH))) {
if ("now".equalsIgnoreCase(dateTime)) {
return System.currentTimeMillis(); return System.currentTimeMillis();
} }
DateFormat df = dfFactory.getPrimaryFormat(); DateFormat df = dfFactory.getPrimaryFormat();


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java View File

@@ -20,7 +20,6 @@
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;
@@ -168,7 +167,7 @@ public class BorlandGenerateClient extends Task {


log("client jar file is " + clientjarfile); log("client jar file is " + clientjarfile);


if (mode.toLowerCase(Locale.ENGLISH).equals(FORK_MODE)) {
if (mode.equalsIgnoreCase(FORK_MODE)) {
executeFork(); executeFork();
} else { } else {
executeJava(); executeJava();


+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java View File

@@ -408,10 +408,9 @@ 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.");
} }
String enc = str_encoding.toLowerCase(Locale.ENGLISH);
if (enc.equals("jpg")) {
if (str_encoding.equalsIgnoreCase("jpg")) {
str_encoding = "JPEG"; str_encoding = "JPEG";
} else if (enc.equals("tif")) {
} else if (str_encoding.equalsIgnoreCase("tif")) {
str_encoding = "TIFF"; str_encoding = "TIFF";
} }
} }


+ 2
- 4
src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java View File

@@ -17,7 +17,6 @@
*/ */
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;
@@ -81,12 +80,11 @@ public final class JspCompilerAdapterFactory {
AntClassLoader loader) AntClassLoader loader)
throws BuildException { throws BuildException {


String compilerTypeLC = compilerType.toLowerCase(Locale.ENGLISH);
if (compilerTypeLC.equals("jasper")) {
if (compilerType.equalsIgnoreCase("jasper")) {
//tomcat4.0 gets the old mangler //tomcat4.0 gets the old mangler
return new JasperC(new JspNameMangler()); return new JasperC(new JspNameMangler());
} }
if (compilerTypeLC.equals("jasper41")) {
if (compilerType.equalsIgnoreCase("jasper41")) {
//tomcat4.1 gets the new one //tomcat4.1 gets the new one
return new JasperC(new Jasper41Mangler()); return new JasperC(new Jasper41Mangler());
} }


+ 2
- 6
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -39,7 +39,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Vector; import java.util.Vector;
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;
@@ -1078,8 +1077,7 @@ public class JUnitTask extends Task {
* @return true if the run should be withoutput and error * @return true if the run should be withoutput and error
*/ */
private boolean equalsWithOutAndErr(String summaryOption) { private boolean equalsWithOutAndErr(String summaryOption) {
return summaryOption != null && "withoutanderr".equals(
summaryOption.toLowerCase(Locale.ENGLISH));
return "withoutanderr".equalsIgnoreCase(summaryOption);
} }


private void checkIncludeSummary(CommandlineJava cmd) { private void checkIncludeSummary(CommandlineJava cmd) {
@@ -1569,9 +1567,7 @@ public class JUnitTask extends Task {
if (summary) { if (summary) {
JUnitTaskMirror.SummaryJUnitResultFormatterMirror f = JUnitTaskMirror.SummaryJUnitResultFormatterMirror f =
delegate.newSummaryJUnitResultFormatter(); delegate.newSummaryJUnitResultFormatter();
String s = summaryValue != null
? summaryValue.toLowerCase(Locale.ENGLISH) : null;
f.setWithOutAndErr("withoutanderr".equals(s));
f.setWithOutAndErr(equalsWithOutAndErr(summaryValue));
delegate.addVmExit(test, f, getDefaultOutput(), message, testCase); delegate.addVmExit(test, f, getDefaultOutput(), message, testCase);
} }
} finally { } finally {


+ 1
- 5
src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java View File

@@ -1536,9 +1536,7 @@ public class FTP extends Task implements FTPTaskConfig {
* synonym for -1. * synonym for -1.
*/ */
public void setRetriesAllowed(String retriesAllowed) { public void setRetriesAllowed(String retriesAllowed) {
String r = retriesAllowed != null
? retriesAllowed.toUpperCase(Locale.ENGLISH) : null;
if ("FOREVER".equals(r)) {
if ("FOREVER".equalsIgnoreCase(retriesAllowed)) {
this.retriesAllowed = Retryable.RETRY_FOREVER; this.retriesAllowed = Retryable.RETRY_FOREVER;
} else { } else {
try { try {
@@ -2571,7 +2569,6 @@ public class FTP extends Task implements FTPTaskConfig {
*/ */
public int getAction() { public int getAction() {
String actionL = getValue().toLowerCase(Locale.ENGLISH); 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;
} else if (actionL.equals("recv") || actionL.equals("get")) { } else if (actionL.equals("recv") || actionL.equals("get")) {
@@ -2630,7 +2627,6 @@ public class FTP extends Task implements FTPTaskConfig {
*/ */
public long getMilliseconds(int action) { public long getMilliseconds(int action) {
String granularityU = getValue().toUpperCase(Locale.ENGLISH); String granularityU = getValue().toUpperCase(Locale.ENGLISH);

if ("".equals(granularityU)) { if ("".equals(granularityU)) {
if (action == SEND_FILES) { if (action == SEND_FILES) {
return GRANULARITY_MINUTE; return GRANULARITY_MINUTE;


+ 1
- 5
src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java View File

@@ -588,9 +588,7 @@ public class FTPTask extends Task implements FTPTaskConfig {
* synonym for -1. * synonym for -1.
*/ */
public void setRetriesAllowed(String retriesAllowed) { public void setRetriesAllowed(String retriesAllowed) {
String r = retriesAllowed != null
? retriesAllowed.toUpperCase(Locale.ENGLISH) : null;
if ("FOREVER".equals(r)) {
if ("FOREVER".equalsIgnoreCase(retriesAllowed)) {
this.retriesAllowed = Retryable.RETRY_FOREVER; this.retriesAllowed = Retryable.RETRY_FOREVER;
} else { } else {
try { try {
@@ -865,7 +863,6 @@ public class FTPTask extends Task implements FTPTaskConfig {
*/ */
public int getAction() { public int getAction() {
String actionL = getValue().toLowerCase(Locale.ENGLISH); 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;
} else if (actionL.equals("recv") || actionL.equals("get")) { } else if (actionL.equals("recv") || actionL.equals("get")) {
@@ -924,7 +921,6 @@ public class FTPTask extends Task implements FTPTaskConfig {
*/ */
public long getMilliseconds(int action) { public long getMilliseconds(int action) {
String granularityU = getValue().toUpperCase(Locale.ENGLISH); String granularityU = getValue().toUpperCase(Locale.ENGLISH);

if ("".equals(granularityU)) { if ("".equals(granularityU)) {
if (action == SEND_FILES) { if (action == SEND_FILES) {
return GRANULARITY_MINUTE; return GRANULARITY_MINUTE;


+ 3
- 5
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java View File

@@ -27,7 +27,6 @@ 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;
@@ -84,12 +83,11 @@ 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) {
filter = filter.toLowerCase(Locale.ENGLISH);
if (filter.equals("all")) {
if (filter.equalsIgnoreCase("all")) {
show = SHOW_ALL; show = SHOW_ALL;
} else if (filter.equals("existing")) {
} else if (filter.equalsIgnoreCase("existing")) {
show = SHOW_EXISTING; show = SHOW_EXISTING;
} else if (filter.equals("non-existing")) {
} else if (filter.equalsIgnoreCase("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: "


+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java View File

@@ -25,7 +25,6 @@ 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;
@@ -96,7 +95,7 @@ public class P4Label extends P4Base {
desc = "AntLabel"; desc = "AntLabel";
} }


if (lock != null && !lock.toLowerCase(Locale.ENGLISH).equals("locked")) {
if (lock != null && !lock.equalsIgnoreCase("locked")) {
log("lock attribute invalid - ignoring", Project.MSG_WARN); log("lock attribute invalid - ignoring", Project.MSG_WARN);
} }


@@ -137,7 +136,7 @@ public class P4Label extends P4Base {
Project.MSG_INFO); Project.MSG_INFO);


//Now lock if required //Now lock if required
if (lock != null && lock.toLowerCase(Locale.ENGLISH).equals("locked")) {
if (lock != null && lock.equalsIgnoreCase("locked")) {


log("Modifying lock status to 'locked'", Project.MSG_INFO); log("Modifying lock status to 'locked'", Project.MSG_INFO);




+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java View File

@@ -28,7 +28,6 @@ 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;
@@ -522,7 +521,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.toLowerCase(Locale.ENGLISH).equals("yes")) {
if (f != null && f.equalsIgnoreCase("yes")) {
force = "yes"; force = "yes";
} else { } else {
force = "no"; force = "no";


+ 2
- 4
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -26,7 +26,6 @@ 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;
@@ -517,10 +516,9 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
if (autoResponse == null) { if (autoResponse == null) {
return FLAG_AUTORESPONSE_DEF; return FLAG_AUTORESPONSE_DEF;
} }
autoResponse = autoResponse.toUpperCase(Locale.ENGLISH);
if (autoResponse.equals("Y")) {
if (autoResponse.equalsIgnoreCase("Y")) {
return FLAG_AUTORESPONSE_YES; return FLAG_AUTORESPONSE_YES;
} else if (autoResponse.equals("N")) {
} else if (autoResponse.equalsIgnoreCase("N")) {
return FLAG_AUTORESPONSE_NO; return FLAG_AUTORESPONSE_NO;
} else { } else {
return FLAG_AUTORESPONSE_DEF; return FLAG_AUTORESPONSE_DEF;


+ 8
- 14
src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java View File

@@ -23,9 +23,6 @@ import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.ClasspathUtils; import org.apache.tools.ant.util.ClasspathUtils;


import java.util.Locale;


/** /**
* Creates the necessary rmic adapter, given basic criteria. * Creates the necessary rmic adapter, given basic criteria.
* *
@@ -96,27 +93,24 @@ public final class RmicAdapterFactory {
public static RmicAdapter getRmic(String rmicType, Task task, public static RmicAdapter getRmic(String rmicType, Task task,
Path classpath) Path classpath)
throws BuildException { throws BuildException {
//convert to lower case in the English locale,
String compiler = rmicType.toLowerCase(Locale.ENGLISH);

//handle default specially by choosing the sun or kaffe compiler //handle default specially by choosing the sun or kaffe compiler
if (DEFAULT_COMPILER.equals(compiler) || compiler.length() == 0) {
compiler = KaffeRmic.isAvailable()
if (DEFAULT_COMPILER.equalsIgnoreCase(rmicType) || rmicType.length() == 0) {
rmicType = KaffeRmic.isAvailable()
? KaffeRmic.COMPILER_NAME ? KaffeRmic.COMPILER_NAME
: SunRmic.COMPILER_NAME; : SunRmic.COMPILER_NAME;
} }
if (SunRmic.COMPILER_NAME.equals(compiler)) {
if (SunRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new SunRmic(); return new SunRmic();
} else if (KaffeRmic.COMPILER_NAME.equals(compiler)) {
} else if (KaffeRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new KaffeRmic(); return new KaffeRmic();
} else if (WLRmic.COMPILER_NAME.equals(compiler)) {
} else if (WLRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new WLRmic(); return new WLRmic();
} else if (ForkingSunRmic.COMPILER_NAME.equals(compiler)) {
} else if (ForkingSunRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new ForkingSunRmic(); return new ForkingSunRmic();
} else if (XNewRmic.COMPILER_NAME.equals(compiler)) {
} else if (XNewRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new XNewRmic(); return new XNewRmic();
} }
//no match? ask for the non-lower-cased type
//no match?
return resolveClassName(rmicType, return resolveClassName(rmicType,
// Memory leak in line below // Memory leak in line below
task.getProject().createClassLoader(classpath)); task.getProject().createClassLoader(classpath));


+ 0
- 9
src/main/org/apache/tools/ant/types/EnumeratedAttribute.java View File

@@ -18,7 +18,6 @@


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;


/** /**
@@ -151,12 +150,4 @@ 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));
}
} }

+ 3
- 5
src/main/org/apache/tools/ant/types/optional/image/Arc.java View File

@@ -22,7 +22,6 @@ 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.
@@ -74,12 +73,11 @@ 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) {
String stype = strType.toLowerCase(Locale.ENGLISH);
if (stype.equals("open")) {
if (strType.equalsIgnoreCase("open")) {
type = Arc2D.OPEN; type = Arc2D.OPEN;
} else if (stype.equals("pie")) {
} else if (strType.equalsIgnoreCase("pie")) {
type = Arc2D.PIE; type = Arc2D.PIE;
} else if (stype.equals("chord")) {
} else if (strType.equalsIgnoreCase("chord")) {
type = Arc2D.CHORD; type = Arc2D.CHORD;
} }
} }


+ 13
- 16
src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java View File

@@ -18,7 +18,6 @@
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;


/** /**
* *
@@ -70,33 +69,31 @@ 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(Locale.ENGLISH);

if (colorName.equals(COLOR_BLACK)) {
if (colorName.equalsIgnoreCase(COLOR_BLACK)) {
return Color.black; return Color.black;
} else if (colorName.equals(COLOR_BLUE)) {
} else if (colorName.equalsIgnoreCase(COLOR_BLUE)) {
return Color.blue; return Color.blue;
} else if (colorName.equals(COLOR_CYAN)) {
} else if (colorName.equalsIgnoreCase(COLOR_CYAN)) {
return Color.cyan; return Color.cyan;
} else if (colorName.equals(COLOR_DARKGRAY) || colorName.equals(COLOR_DARKGREY)) {
} else if (colorName.equalsIgnoreCase(COLOR_DARKGRAY) || colorName.equalsIgnoreCase(COLOR_DARKGREY)) {
return Color.darkGray; return Color.darkGray;
} else if (colorName.equals(COLOR_GRAY) || colorName.equals(COLOR_GREY)) {
} else if (colorName.equalsIgnoreCase(COLOR_GRAY) || colorName.equalsIgnoreCase(COLOR_GREY)) {
return Color.gray; return Color.gray;
} else if (colorName.equals(COLOR_LIGHTGRAY) || colorName.equals(COLOR_LIGHTGREY)) {
} else if (colorName.equalsIgnoreCase(COLOR_LIGHTGRAY) || colorName.equalsIgnoreCase(COLOR_LIGHTGREY)) {
return Color.lightGray; return Color.lightGray;
} else if (colorName.equals(COLOR_GREEN)) {
} else if (colorName.equalsIgnoreCase(COLOR_GREEN)) {
return Color.green; return Color.green;
} else if (colorName.equals(COLOR_MAGENTA)) {
} else if (colorName.equalsIgnoreCase(COLOR_MAGENTA)) {
return Color.magenta; return Color.magenta;
} else if (colorName.equals(COLOR_ORANGE)) {
} else if (colorName.equalsIgnoreCase(COLOR_ORANGE)) {
return Color.orange; return Color.orange;
} else if (colorName.equals(COLOR_PINK)) {
} else if (colorName.equalsIgnoreCase(COLOR_PINK)) {
return Color.pink; return Color.pink;
} else if (colorName.equals(COLOR_RED)) {
} else if (colorName.equalsIgnoreCase(COLOR_RED)) {
return Color.red; return Color.red;
} else if (colorName.equals(COLOR_WHITE)) {
} else if (colorName.equalsIgnoreCase(COLOR_WHITE)) {
return Color.white; return Color.white;
} else if (colorName.equals(COLOR_YELLOW)) {
} else if (colorName.equalsIgnoreCase(COLOR_YELLOW)) {
return Color.yellow; return Color.yellow;
} }
return Color.black; return Color.black;


+ 1
- 4
src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java View File

@@ -22,7 +22,6 @@ 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;
@@ -83,9 +82,7 @@ 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 (paramname != null
&& EXPRESSION_KEY.equals(paramname
.toLowerCase(Locale.ENGLISH))) {
if (EXPRESSION_KEY.equalsIgnoreCase(paramname)) {
setExpression(parameters[i].getValue()); setExpression(parameters[i].getValue());
} else { } else {
setError("Invalid parameter " + paramname); setError("Invalid parameter " + paramname);


+ 3
- 7
src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java View File

@@ -22,7 +22,6 @@ 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;
@@ -113,15 +112,12 @@ 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 (paramname != null) {
paramname = paramname.toLowerCase(Locale.ENGLISH);
}
if (CONTAINS_KEY.equals(paramname)) {
if (CONTAINS_KEY.equalsIgnoreCase(paramname)) {
setText(parameters[i].getValue()); setText(parameters[i].getValue());
} else if (CASE_KEY.equals(paramname)) {
} else if (CASE_KEY.equalsIgnoreCase(paramname)) {
setCasesensitive(Project.toBoolean( setCasesensitive(Project.toBoolean(
parameters[i].getValue())); parameters[i].getValue()));
} else if (WHITESPACE_KEY.equals(paramname)) {
} else if (WHITESPACE_KEY.equalsIgnoreCase(paramname)) {
setIgnorewhitespace(Project.toBoolean( setIgnorewhitespace(Project.toBoolean(
parameters[i].getValue())); parameters[i].getValue()));
} else { } else {


+ 6
- 9
src/main/org/apache/tools/ant/types/selectors/DateSelector.java View File

@@ -171,30 +171,27 @@ 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 (paramname != null) {
paramname = paramname.toLowerCase(Locale.ENGLISH);
}
if (MILLIS_KEY.equals(paramname)) {
if (MILLIS_KEY.equalsIgnoreCase(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.equals(paramname)) {
} else if (DATETIME_KEY.equalsIgnoreCase(paramname)) {
setDatetime(parameters[i].getValue()); setDatetime(parameters[i].getValue());
} else if (CHECKDIRS_KEY.equals(paramname)) {
} else if (CHECKDIRS_KEY.equalsIgnoreCase(paramname)) {
setCheckdirs(Project.toBoolean(parameters[i].getValue())); setCheckdirs(Project.toBoolean(parameters[i].getValue()));
} else if (GRANULARITY_KEY.equals(paramname)) {
} else if (GRANULARITY_KEY.equalsIgnoreCase(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.equals(paramname)) {
} else if (WHEN_KEY.equalsIgnoreCase(paramname)) {
setWhen(new TimeComparison(parameters[i].getValue())); setWhen(new TimeComparison(parameters[i].getValue()));
} else if (PATTERN_KEY.equals(paramname)) {
} else if (PATTERN_KEY.equalsIgnoreCase(paramname)) {
setPattern(parameters[i].getValue()); setPattern(parameters[i].getValue());
} else { } else {
setError("Invalid parameter " + paramname); setError("Invalid parameter " + paramname);


+ 2
- 6
src/main/org/apache/tools/ant/types/selectors/DepthSelector.java View File

@@ -19,7 +19,6 @@
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;
@@ -95,17 +94,14 @@ 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 (paramname != null) {
paramname = paramname.toLowerCase(Locale.ENGLISH);
}
if (MIN_KEY.equals(paramname)) {
if (MIN_KEY.equalsIgnoreCase(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.equals(paramname)) {
} else if (MAX_KEY.equalsIgnoreCase(paramname)) {
try { try {
setMax(Integer.parseInt(parameters[i].getValue())); setMax(Integer.parseInt(parameters[i].getValue()));
} catch (NumberFormatException nfe1) { } catch (NumberFormatException nfe1) {


+ 4
- 8
src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java View File

@@ -19,7 +19,6 @@
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;
@@ -134,17 +133,14 @@ 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 (paramname != null) {
paramname = paramname.toLowerCase(Locale.ENGLISH);
}
if (NAME_KEY.equals(paramname)) {
if (NAME_KEY.equalsIgnoreCase(paramname)) {
setName(parameters[i].getValue()); setName(parameters[i].getValue());
} else if (CASE_KEY.equals(paramname)) {
} else if (CASE_KEY.equalsIgnoreCase(paramname)) {
setCasesensitive(Project.toBoolean( setCasesensitive(Project.toBoolean(
parameters[i].getValue())); parameters[i].getValue()));
} else if (NEGATE_KEY.equals(paramname)) {
} else if (NEGATE_KEY.equalsIgnoreCase(paramname)) {
setNegate(Project.toBoolean(parameters[i].getValue())); setNegate(Project.toBoolean(parameters[i].getValue()));
} else if (REGEX_KEY.equals(paramname)) {
} else if (REGEX_KEY.equalsIgnoreCase(paramname)) {
setRegex(parameters[i].getValue()); setRegex(parameters[i].getValue());
} else { } else {
setError("Invalid parameter " + paramname); setError("Invalid parameter " + paramname);


+ 3
- 7
src/main/org/apache/tools/ant/types/selectors/SizeSelector.java View File

@@ -19,7 +19,6 @@
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;
@@ -170,21 +169,18 @@ 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 (paramname != null) {
paramname = paramname.toLowerCase(Locale.ENGLISH);
}
if (SIZE_KEY.equals(paramname)) {
if (SIZE_KEY.equalsIgnoreCase(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.equals(paramname)) {
} else if (UNITS_KEY.equalsIgnoreCase(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.equals(paramname)) {
} else if (WHEN_KEY.equalsIgnoreCase(paramname)) {
SizeComparisons scmp = new SizeComparisons(); SizeComparisons scmp = new SizeComparisons();
scmp.setValue(parameters[i].getValue()); scmp.setValue(parameters[i].getValue());
setWhen(scmp); setWhen(scmp);


+ 1
- 5
src/main/org/apache/tools/ant/types/selectors/TypeSelector.java View File

@@ -19,7 +19,6 @@
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;
@@ -72,10 +71,7 @@ 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 (paramname != null) {
paramname = paramname.toLowerCase(Locale.ENGLISH);
}
if (TYPE_KEY.equals(paramname)) {
if (TYPE_KEY.equalsIgnoreCase(paramname)) {
FileType t = new FileType(); FileType t = new FileType();
t.setValue(parameters[i].getValue()); t.setValue(parameters[i].getValue());
setType(t); setType(t);


+ 3
- 6
src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java View File

@@ -23,7 +23,6 @@ package org.apache.tools.ant.types.selectors.modifiedselector;
import java.io.File; import java.io.File;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.Locale;
import java.util.Vector; import java.util.Vector;


// Ant // Ant
@@ -721,8 +720,6 @@ 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);
@@ -737,19 +734,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".equals(valueLC))
("true".equalsIgnoreCase(value))
? true ? true
: false; : false;
setUpdate(updateValue); setUpdate(updateValue);
} else if ("delayupdate".equals(key)) { } else if ("delayupdate".equals(key)) {
boolean updateValue = boolean updateValue =
("true".equals(valueLC))
("true".equalsIgnoreCase(value))
? true ? true
: false; : false;
setDelayUpdate(updateValue); setDelayUpdate(updateValue);
} else if ("seldirs".equals(key)) { } else if ("seldirs".equals(key)) {
boolean sdValue = boolean sdValue =
("true".equals(valueLC))
("true".equalsIgnoreCase(value))
? true ? true
: false; : false;
setSeldirs(sdValue); setSeldirs(sdValue);


+ 3
- 7
src/main/org/apache/tools/ant/util/LeadPipeInputStream.java View File

@@ -21,7 +21,6 @@ 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;
@@ -88,17 +87,14 @@ public class LeadPipeInputStream extends PipedInputStream {
result = super.read(); result = super.read();
} catch (IOException eyeOhEx) { } catch (IOException eyeOhEx) {
String msg = eyeOhEx.getMessage(); String msg = eyeOhEx.getMessage();
if (msg != null) {
msg = msg.toLowerCase(Locale.ENGLISH);
}
if ("write end dead".equals(msg)) {
if ("write end dead".equalsIgnoreCase(msg)) {
if (super.in > 0 && super.out < super.buffer.length 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;
} }
} else { } else {
log("error at LeadPipeInputStream.read(): "
+ eyeOhEx.getMessage(), Project.MSG_INFO);
log("error at LeadPipeInputStream.read(): " + msg,
Project.MSG_INFO);
} }
} }
return result; return result;


+ 1
- 2
src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java View File

@@ -21,7 +21,6 @@ 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 +89,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".equals(getLanguage().toUpperCase(Locale.ENGLISH))) {
if ("FX".equalsIgnoreCase(getLanguage())) {
engine.invoke( engine.invoke(
"put", String.class, key "put", String.class, key
+ ":" + value.getClass().getName(), + ":" + value.getClass().getName(),


+ 3
- 8
src/main/org/apache/tools/zip/ZipEncodingHelper.java View File

@@ -191,15 +191,10 @@ abstract class ZipEncodingHelper {
*/ */
static final String UTF8 = "UTF8"; static final String UTF8 = "UTF8";


/**
* name of the encoding UTF-8 used for comparisions.
*/
private static final String UTF8_LC = UTF8.toLowerCase(Locale.ENGLISH);

/** /**
* variant name of the encoding UTF-8 used for comparisions. * variant name of the encoding UTF-8 used for comparisions.
*/ */
private static final String UTF_DASH_8_LC = "utf-8";
private static final String UTF_DASH_8 = "utf-8";


/** /**
* name of the encoding UTF-8 * name of the encoding UTF-8
@@ -250,7 +245,7 @@ abstract class ZipEncodingHelper {
// check platform's default encoding // check platform's default encoding
encoding = System.getProperty("file.encoding"); encoding = System.getProperty("file.encoding");
} }
String enc = encoding.toLowerCase(Locale.ENGLISH);
return UTF8_LC.equals(enc) || UTF_DASH_8_LC.equals(enc);
return UTF8.equalsIgnoreCase(encoding)
|| UTF_DASH_8.equalsIgnoreCase(encoding);
} }
} }

+ 42
- 0
src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java View File

@@ -18,6 +18,7 @@


package org.apache.tools.ant.types.selectors; package org.apache.tools.ant.types.selectors;


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.types.Parameter; import org.apache.tools.ant.types.Parameter;
@@ -198,4 +199,45 @@ public class SizeSelectorTest extends BaseSelectorTest {


} }


public void testParameterParsingLowerCase() {
testCaseInsensitiveParameterParsing("units");
}

public void testParameterParsingUpperCase() {
testCaseInsensitiveParameterParsing("UNITS");
}

public void testParameterParsingLowerCaseTurkish() {
Locale l = Locale.getDefault();
try {
Locale.setDefault(new Locale("tr"));
testCaseInsensitiveParameterParsing("units");
} finally {
Locale.setDefault(l);
}
}

public void testParameterParsingUpperCaseTurkish() {
Locale l = Locale.getDefault();
try {
Locale.setDefault(new Locale("tr"));
testCaseInsensitiveParameterParsing("UNITS");
} finally {
Locale.setDefault(l);
}
}

private void testCaseInsensitiveParameterParsing(String name) {
SizeSelector s = new SizeSelector();
Parameter p = new Parameter();
p.setName(name);
p.setValue("foo");
try {
s.setParameters(new Parameter[] {p});
fail("should have caused an exception");
} catch (BuildException be) {
assertEquals("foo is not a legal value for this attribute",
be.getMessage());
}
}
} }

Loading…
Cancel
Save