You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2006/12/10 23:54:09 UTC
svn commit: r485295 -
/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
Author: peterreilly
Date: Sun Dec 10 14:54:07 2006
New Revision: 485295
URL: http://svn.apache.org/viewvc?view=rev&rev=485295
Log:
retain the original casiness when handing replaceing case insensitive env properties
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java?view=diff&rev=485295&r1=485294&r2=485295
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java Sun Dec 10 14:54:07 2006
@@ -625,24 +625,32 @@
}
Vector osEnv = (Vector) getProcEnvironment().clone();
for (int i = 0; i < env.length; i++) {
+ String keyValue = env[i];
// Get key including "="
- String key = env[i].substring(0, env[i].indexOf('=') + 1);
+ String key = keyValue.substring(0, keyValue.indexOf('=') + 1);
if (environmentCaseInSensitive) {
// Nb: using default locale as key is a env name
key = key.toLowerCase();
}
int size = osEnv.size();
+ // Find the key in the current enviroment copy
+ // and remove it.
for (int j = 0; j < size; j++) {
String osEnvItem = (String) osEnv.elementAt(j);
- if (environmentCaseInSensitive) {
- osEnvItem = osEnvItem.toLowerCase();
- }
- if (osEnvItem.startsWith(key)) {
+ String convertedItem = environmentCaseInSensitive
+ ? osEnvItem.toLowerCase() : osEnvItem;
+ if (convertedItem.startsWith(key)) {
osEnv.removeElementAt(j);
+ if (environmentCaseInSensitive) {
+ // Use the original casiness of the key
+ keyValue = osEnvItem.substring(0, key.length())
+ + keyValue.substring(key.length());
+ }
break;
}
}
- osEnv.addElement(env[i]);
+ // Add the key to the enviromnent copy
+ osEnv.addElement(keyValue);
}
return (String[]) (osEnv.toArray(new String[osEnv.size()]));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org