ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Ant.java CallTarget.java
Date Wed, 10 Apr 2002 09:44:37 GMT
bodewig     02/04/10 02:44:37

  Modified:    src/main/org/apache/tools/ant/taskdefs Ant.java
                        CallTarget.java
  Log:
  fix possible (but unlikely) NPE in <antcall>, add some docs.
  
  Revision  Changes    Path
  1.48      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
  
  Index: Ant.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- Ant.java	10 Apr 2002 09:32:38 -0000	1.47
  +++ Ant.java	10 Apr 2002 09:44:37 -0000	1.48
  @@ -157,7 +157,7 @@
       }
   
       /**
  -     * Called in execute or createProperty of newProject is null.
  +     * Called in execute or createProperty if newProject is null.
        *
        * <p>This can happen if the same instance of this task is run
        * twice as newProject is set to null at the end of execute (to
  
  
  
  1.18      +33 -9     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/CallTarget.java
  
  Index: CallTarget.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/CallTarget.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- CallTarget.java	8 Apr 2002 06:34:10 -0000	1.17
  +++ CallTarget.java	10 Apr 2002 09:44:37 -0000	1.18
  @@ -85,8 +85,9 @@
   
       private Ant callee;
       private String subTarget;
  -    private boolean initialized = false;
  +    // must match the default value of Ant#inheritAll
       private boolean inheritAll = true;
  +    // must match the default value of Ant#inheritRefs
       private boolean inheritRefs = false;
   
       /**
  @@ -96,7 +97,7 @@
        **/
       public void setInheritAll(boolean inherit) {
          inheritAll = inherit;
  -    } //-- setInheritAll
  +    }
   
       /**
        * set the inherit refs flag
  @@ -111,12 +112,11 @@
        * configuring it's by calling its own init method.
        */
       public void init() {
  -        callee = (Ant) project.createTask("ant");
  -        callee.setOwningTarget(target);
  +        callee = (Ant) getProject().createTask("ant");
  +        callee.setOwningTarget(getOwningTarget());
           callee.setTaskName(getTaskName());
  -        callee.setLocation(location);
  +        callee.setLocation(getLocation());
           callee.init();
  -        initialized = true;
       }
   
       /**
  @@ -125,7 +125,7 @@
        * execute
        */
       public void execute() throws BuildException {
  -        if (!initialized) {
  +        if (callee == null) {
               init();
           }
           
  @@ -134,30 +134,49 @@
                                        location);
           }
           
  -        callee.setDir(project.getBaseDir());
  -        callee.setAntfile(project.getProperty("ant.file"));
  +        callee.setDir(getProject().getBaseDir());
  +        callee.setAntfile(getProject().getProperty("ant.file"));
           callee.setTarget(subTarget);
           callee.setInheritAll(inheritAll);
           callee.setInheritRefs(inheritRefs);
           callee.execute();
       }
   
  +    /**
  +     * Create a nested param element.
  +     */
       public Property createParam() {
  +        if (callee == null) {
  +            init();
  +        }
           return callee.createProperty();
       }
   
       /** 
        * create a reference element that identifies a data type that
        * should be carried over to the new project.
  +     *
  +     * @since Ant 1.5
        */
       public void addReference(Ant.Reference r) {
  +        if (callee == null) {
  +            init();
  +        }
           callee.addReference(r);
       }
   
  +    /**
  +     * Sets the target attribute, required.
  +     */
       public void setTarget(String target) {
           subTarget = target;
       }
   
  +    /**
  +     * Pass output sent to System.out to the new project.
  +     *
  +     * @since Ant 1.5
  +     */
       protected void handleOutput(String line) {
           if (callee != null) {
               callee.handleOutput(line);
  @@ -167,6 +186,11 @@
           }
       }
       
  +    /**
  +     * Pass output sent to System.err to the new project.
  +     *
  +     * @since Ant 1.5
  +     */
       protected void handleErrorOutput(String line) {
           if (callee != null) {
               callee.handleErrorOutput(line);
  
  
  

--
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