You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by co...@apache.org on 2001/07/31 13:24:41 UTC

cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs PropertyTest.java

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");
  +    }
  +    
   }
  
  
  

Re: ejbjar: find helper classes

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Holger,

I'm going to hold this over till after the 1.4 release. I have been
considering an alternative approach for a while now and believe it will
give better results. That approach is to use the class dependency
information in much the same was as the <depend> task does. This has two
advantages. It doesn't require the bean classes to be loaded into Ant's VM
and it should add all required classes. The approach you have taken will
add some more classes but not them all (internal classes, the classes used
by the classes that are method parameters, exceptions, etc will not be
included)

Thanks for submitting this.

Conor


----- Original Message -----
From: "Holger Engels" <he...@mercatis.de>
To: <an...@jakarta.apache.org>
Sent: Tuesday, July 31, 2001 9:58 PM
Subject: ejbjar: find helper classes


>
> EJBs do often use several helper classes, that apper as exceptions,
> arguments and return values in their signatures. With a little more
> reflection, we can find most of them.
>
> .. attached is a diff, that could be applied to revision 1.20 of
> GenericDeployTool.java
>
> Holger
>


ejbjar: find helper classes

Posted by Holger Engels <he...@mercatis.de>.
EJBs do often use several helper classes, that apper as exceptions,
arguments and return values in their signatures. With a little more
reflection, we can find most of them.

.. attached is a diff, that could be applied to revision 1.20 of
GenericDeployTool.java

Holger