conor       2003/02/17 06:21:12

  Modified:    docs/manual Tag: ANT_15_BRANCH develop.html
               src/main/org/apache/tools/ant Tag: ANT_15_BRANCH
                        Project.java
  Log:
  Merge
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.10.2.4  +8 -0      ant/docs/manual/develop.html
  
  Index: develop.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/develop.html,v
  retrieving revision 1.10.2.3
  retrieving revision 1.10.2.4
  diff -u -w -u -r1.10.2.3 -r1.10.2.4
  --- develop.html      24 Jan 2003 10:04:07 -0000      1.10.2.3
  +++ develop.html      17 Feb 2003 14:21:12 -0000      1.10.2.4
  @@ -336,6 +336,14 @@
   <p>will run Ant with a listener that generates an XML representation of the 
build progress. This
   listener is included with Ant, as is the default listener, which generates 
the logging to standard output.</p>
   
  +<p><b>Note: </b>A listener must not access System.out and System.err 
directly since ouput on 
  +these streams is redirected by Ant's core to the build event system. 
Accessing these 
  +streams can cause an infinite loop in Ant. Depending on the version of Ant, 
this will
  +either cause the build to terminate or the Java VM to run out of Stack 
space. A logger, also, may 
  +not access System.out and System.err directly. It must use the streams with 
which it has
  +been configured.
  +</p>
  +
   <hr>
   <h2><a name="integration">Source code integration</a></h2>
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.108.2.12 +18 -4     ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.108.2.11
  retrieving revision 1.108.2.12
  diff -u -w -u -r1.108.2.11 -r1.108.2.12
  --- Project.java      10 Feb 2003 14:24:37 -0000      1.108.2.11
  +++ Project.java      17 Feb 2003 14:21:12 -0000      1.108.2.12
  @@ -232,6 +232,11 @@
       private FileUtils fileUtils;
   
       /**
  +     * Flag which catches Listeners which try to use System.out or 
System.err 
  +     */
  +    private boolean loggingMessage = false;
  +    
  +    /**
        * Creates a new Ant project.
        */
       public Project() {
  @@ -1999,9 +2004,18 @@
                                           int priority) {
           event.setMessage(message, priority);
           Vector listeners = getBuildListeners();
  +        synchronized(this) {
  +            if (loggingMessage) {
  +                throw new BuildException("Listener attempted to access " 
  +                    + (priority == MSG_ERR ? "System.err" : "System.out") 
  +                    + " - infinite loop terminated");
  +            }
  +            loggingMessage = true;                
           for (int i = 0; i < listeners.size(); i++) {
               BuildListener listener = (BuildListener) listeners.elementAt(i);
               listener.messageLogged(event);
  +            }
  +            loggingMessage = false;
           }
       }
   
  
  
  

Reply via email to