ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec Environment.java
Date Sat, 05 Jan 2002 03:07:00 GMT
donaldp     02/01/04 19:07:00

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec
                        Environment.java
  Log:
  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.
  
  Revision  Changes    Path
  1.7       +8 -26     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/Environment.java
  
  Index: Environment.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/Environment.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Environment.java	1 Jan 2002 06:16:24 -0000	1.6
  +++ Environment.java	5 Jan 2002 03:07:00 -0000	1.7
  @@ -25,7 +25,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:thomas.haas@softwired-inc.com">Thomas Haas</a>
  - * @version $Revision: 1.6 $ $Date: 2002/01/01 06:16:24 $
  + * @version $Revision: 1.7 $ $Date: 2002/01/05 03:07:00 $
    */
   public final class Environment
   {
  @@ -65,36 +65,15 @@
       }
   
       /**
  -     * 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.
        */
       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 @@
           }
   
           // Since we "look ahead" before adding, there's one last env var.
  -        addProperty( properties, var );
  +        if( null != var )
  +        {
  +            addProperty( properties, var );
  +        }
           return properties;
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message