ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs PropertyTest.java
Date Tue, 31 Jul 2001 11:24:41 GMT
conor       01/07/31 04:24:41

  Modified:    src/etc/testcases/taskdefs property.xml
               src/main/org/apache/tools/ant/taskdefs Property.java
               src/testcases/org/apache/tools/ant/taskdefs
                        PropertyTest.java
  Added:       src/etc/testcases/taskdefs property3.properties
  Log:
  Resolve properties within properties files by first consulting the project
  properties first.
  
  PR:	2915
  
  Revision  Changes    Path
  1.4       +5 -0      jakarta-ant/src/etc/testcases/taskdefs/property.xml
  
  Index: property.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/property.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- property.xml	2001/07/25 14:40:54	1.3
  +++ property.xml	2001/07/31 11:24:41	1.4
  @@ -16,4 +16,9 @@
       <property file="property2.properties"/>
     </target>
   
  +  <target name="test4">
  +    <property name="http.port" value="999" />
  +    <property file="property3.properties"/>
  +    <echo message="http.url is ${http.url}"/>
  +  </target>
   </project>
  
  
  
  1.1                  jakarta-ant/src/etc/testcases/taskdefs/property3.properties
  
  Index: property3.properties
  ===================================================================
  http.port = 80
  http.url = http://localhost:${http.port}
  
  
  
  
  
  1.31      +11 -8     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Property.java	2001/07/25 14:17:37	1.30
  +++ Property.java	2001/07/31 11:24:41	1.31
  @@ -178,7 +178,7 @@
           }
       }
   
  -    protected void loadFile (File file) throws BuildException {
  +    protected void loadFile(File file) throws BuildException {
           Properties props = new Properties();
           log("Loading " + file.getAbsolutePath(), Project.MSG_VERBOSE);
           try {
  @@ -201,7 +201,7 @@
           }
       }
   
  -    protected void loadResource( String name ) {
  +    protected void loadResource(String name) {
           Properties props = new Properties();
           log("Resource Loading " + name, Project.MSG_VERBOSE);
           try {
  @@ -300,12 +300,15 @@
                               if (propertyName.equals(name)) {
                                   throw new BuildException("Property " + name + " was circularly
defined.");
                               }
  -                            if (props.containsKey(propertyName)) {
  -                                fragment = props.getProperty(propertyName);
  -                                resolved = false;
  -                            }
  -                            else {
  -                                fragment = "${" + propertyName + "}";
  +                            fragment = getProject().getProperty(propertyName);
  +                            if (fragment == null) {
  +                                if (props.containsKey(propertyName)) {
  +                                    fragment = props.getProperty(propertyName);
  +                                    resolved = false;
  +                                }
  +                                else {
  +                                    fragment = "${" + propertyName + "}";
  +                                }
                               }
                           }
                           sb.append(fragment);
  
  
  
  1.4       +4 -0      jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/PropertyTest.java
  
  Index: PropertyTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/PropertyTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PropertyTest.java	2001/07/25 14:40:54	1.3
  +++ PropertyTest.java	2001/07/31 11:24:41	1.4
  @@ -90,4 +90,8 @@
           fail("Did not throw exception on circular exception");                     
       }
   
  +    public void test4() { 
  +        expectLog("test4", "http.url is http://localhost:999");
  +    }
  +    
   }
  
  
  

Mime
View raw message