Browse Source

Make sure a property file with no properties in it does not cause any exceptions.

Removed an unused method.

Made the Properties object returned from getNativeEnvironment() contain all environment properties rather than having the environment properties as default properties for property object. This allows much easier direct access to prpoerty values.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270517 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
5b78d0ba6f
1 changed files with 7 additions and 25 deletions
  1. +7
    -25
      proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/Environment.java

+ 7
- 25
proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/Environment.java View File

@@ -64,29 +64,6 @@ public final class Environment
}
}

/**
* Retrieve an array of EnvironmentData vars that contains a list of all
* native EnvironmentData Variables for the current process.
*/
private static String[] getNativeEnvironmentAsArray()
throws IOException, ExecException
{
final Properties environment = getEnvironmentVariables();

final String[] env = new String[ environment.size() ];
final Iterator keys = environment.keySet().iterator();
int index = 0;
while( keys.hasNext() )
{
final String key = (String)keys.next();
final String value = environment.getProperty( key );
env[ index ] = key + '=' + value;
index++;
}

return env;
}

/**
* Retrieve a Properties object that contains the list of all
* native EnvironmentData Variables for the current process.
@@ -94,7 +71,9 @@ public final class Environment
public static Properties getNativeEnvironment()
throws IOException, ExecException
{
return new Properties( getEnvironmentVariables() );
final Properties properties = new Properties();
properties.putAll( getEnvironmentVariables() );
return properties;
}

/**
@@ -151,7 +130,10 @@ public final class Environment
}

// Since we "look ahead" before adding, there's one last env var.
addProperty( properties, var );
if( null != var )
{
addProperty( properties, var );
}
return properties;
}



Loading…
Cancel
Save