Browse Source

Fix sysproperty handling (testcase fails for old code and passes for

new code).


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271366 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
96203d2041
2 changed files with 7 additions and 2 deletions
  1. +6
    -2
      src/main/org/apache/tools/ant/types/CommandlineJava.java
  2. +1
    -0
      src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java

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

@@ -111,8 +111,12 @@ public class CommandlineJava implements Cloneable {

public void setSystem() throws BuildException {
try {
Properties p = new Properties(sys = System.getProperties());
sys = System.getProperties();
Properties p = new Properties();
for (Enumeration e = sys.keys(); e.hasMoreElements(); ) {
Object o = e.nextElement();
p.put(o, sys.get(o));
}
for (Enumeration e = variables.elements(); e.hasMoreElements(); ) {
Environment.Variable v = (Environment.Variable) e.nextElement();
p.put(v.getKey(), v.getValue());


+ 1
- 0
src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java View File

@@ -150,6 +150,7 @@ public class CommandlineJavaTest extends TestCase {
assertEquals(currentClasspath, newClasspath);
assertNotNull(System.getProperty("key"));
assertEquals("value", System.getProperty("key"));
assertTrue(System.getProperties().containsKey("java.class.path"));
} finally {
c.restoreSystemProperties();
}


Loading…
Cancel
Save