Author: peterreilly
Date: Sat Sep 16 16:48:30 2006
New Revision: 446979

URL: http://svn.apache.org/viewvc?view=rev&rev=446979
Log:
bugzilla 28874: make env case insensitive for windows

Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?view=diff&rev=446979&r1=446978&r2=446979
==============================================================================
Binary files - no diff available.

Modified: ant/core/trunk/WHATSNEW
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=446979&r1=446978&r2=446979
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Sat Sep 16 16:48:30 2006
@@ -9,6 +9,9 @@
 * 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:
 -----------
 

Modified: ant/core/trunk/contributors.xml
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?view=diff&rev=446979&r1=446978&r2=446979
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Sat Sep 16 16:48:30 2006
@@ -1011,6 +1011,10 @@
     <last>Werner</last>
   </name>
   <name>
+    <first>Xavier</first>
+    <last>Witdouck</last>
+  </name>
+  <name>
     <first>Yohann</first>
     <last>Roussel</last>
   </name>

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=446979&r1=446978&r2=446979
==============================================================================
--- 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 Sat Sep 
16 16:48:30 2006
@@ -79,6 +79,9 @@
     /** 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 @@
             // 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 @@
         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;
                 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to