Browse Source

bugzilla 28874: make env case insensitive for windows

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@446979 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 19 years ago
parent
commit
e089347c34
4 changed files with 21 additions and 2 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +3
    -0
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +13
    -2
      src/main/org/apache/tools/ant/taskdefs/Execute.java

+ 1
- 0
CONTRIBUTORS View File

@@ -254,6 +254,7 @@ Wolf Siberski
Wolfgang Baer
Wolfgang Frech
Wolfgang Werner
Xavier Witdouck
Yohann Roussel
Yuji Yamano
Yves Martin


+ 3
- 0
WHATSNEW View File

@@ -9,6 +9,9 @@ Changes that could break older environments:
* unrestrict the dbvendor names in the websphere element of the ejbjar task.
Bugzilla Report 40475.

* <env> nested element in <java>, <exec> and others is now case-insensitive
for windows OS. Bugzilla Report 28826.

Fixed bugs:
-----------



+ 4
- 0
contributors.xml View File

@@ -1010,6 +1010,10 @@
<first>Wolfgang</first>
<last>Werner</last>
</name>
<name>
<first>Xavier</first>
<last>Witdouck</last>
</name>
<name>
<first>Yohann</first>
<last>Roussel</last>


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

@@ -79,6 +79,9 @@ public class Execute {
/** Used to destroy processes when the VM exits. */
private static ProcessDestroyer processDestroyer = new ProcessDestroyer();

/** Used for replacing env variables */
private static boolean environmentCaseInSensitive = false;

/*
* Builds a command launcher for the OS and JVM we are running under.
*/
@@ -98,7 +101,7 @@ public class Execute {
// OS/2
shellLauncher = new OS2CommandLauncher(new CommandLauncher());
} else if (Os.isFamily("windows")) {
environmentCaseInSensitive = true;
CommandLauncher baseLauncher = new CommandLauncher();

if (!Os.isFamily("win9x")) {
@@ -624,9 +627,17 @@ public class Execute {
for (int i = 0; i < env.length; i++) {
// Get key including "="
String key = env[i].substring(0, env[i].indexOf('=') + 1);
if (environmentCaseInSensitive) {
// Nb: using default locale as key is a env name
key = key.toLowerCase();
}
int size = osEnv.size();
for (int j = 0; j < size; j++) {
if (((String) osEnv.elementAt(j)).startsWith(key)) {
String osEnvItem = (String) osEnv.elementAt(j);
if (environmentCaseInSensitive) {
osEnvItem = osEnvItem.toLowerCase();
}
if (osEnvItem.startsWith(key)) {
osEnv.removeElementAt(j);
break;
}


Loading…
Cancel
Save