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/main/org/apache/tools/ant XmlLogger.java
Date Wed, 29 Jan 2003 11:11:51 GMT
conor       2003/01/29 03:11:51

  Modified:    src/main/org/apache/tools/ant Tag: ANT_15_BRANCH
                        XmlLogger.java
  Log:
  Merge fix for 7926 from 1.6 and the import cleanups
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.30.2.1  +41 -14    jakarta-ant/src/main/org/apache/tools/ant/XmlLogger.java
  
  Index: XmlLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/XmlLogger.java,v
  retrieving revision 1.30
  retrieving revision 1.30.2.1
  diff -u -w -u -r1.30 -r1.30.2.1
  --- XmlLogger.java	17 Apr 2002 05:50:09 -0000	1.30
  +++ XmlLogger.java	29 Jan 2003 11:11:51 -0000	1.30.2.1
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -54,14 +54,6 @@
   
   package org.apache.tools.ant;
   
  -import org.apache.tools.ant.util.DOMElementWriter;
  -import org.apache.tools.ant.util.StringUtils;
  -import org.w3c.dom.Document;
  -import org.w3c.dom.Element;
  -import org.w3c.dom.Text;
  -
  -import javax.xml.parsers.DocumentBuilder;
  -import javax.xml.parsers.DocumentBuilderFactory;
   import java.io.FileOutputStream;
   import java.io.IOException;
   import java.io.OutputStream;
  @@ -70,6 +62,14 @@
   import java.io.Writer;
   import java.util.Hashtable;
   import java.util.Stack;
  +import java.util.Enumeration;
  +import javax.xml.parsers.DocumentBuilder;
  +import javax.xml.parsers.DocumentBuilderFactory;
  +import org.apache.tools.ant.util.DOMElementWriter;
  +import org.apache.tools.ant.util.StringUtils;
  +import org.w3c.dom.Document;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Text;
   
   /**
    * Generates a file in the current directory with
  @@ -312,11 +312,11 @@
        *              Will not be <code>null</code>.
        */
       public void taskStarted(BuildEvent event) {
  -        Task task = event.getTask();
           TimedElement taskElement = new TimedElement();
           taskElement.startTime = System.currentTimeMillis();
           taskElement.element = doc.createElement(TASK_TAG);
   
  +        Task task = event.getTask();
           String name = event.getTask().getTaskName();
           taskElement.element.setAttribute(NAME_ATTR, name);
           taskElement.element.setAttribute(LOCATION_ATTR,
  @@ -361,6 +361,31 @@
           }
       }
   
  +
  +    /**
  +     * Get the TimedElement associated with a task.
  +     *
  +     * Where the task is not found directly, search for unknown elements which
  +     * may be hiding the real task
  +     */
  +    private TimedElement getTaskElement(Task task) {
  +        TimedElement element = (TimedElement) tasks.get(task);
  +        if (element != null) {
  +            return element;
  +        }
  +
  +        for (Enumeration e = tasks.keys(); e.hasMoreElements();) {
  +            Task key = (Task) e.nextElement();
  +            if (key instanceof UnknownElement) {
  +                if (((UnknownElement) key).getTask() == task) {
  +                    return (TimedElement) tasks.get(key);
  +                }
  +            }
  +        }
  +
  +        return null;
  +    }
  +
       /**
        * Fired when a message is logged, this adds a message element to the
        * most appropriate parent element (task, target or build) and records
  @@ -402,12 +427,13 @@
   
           Target target = event.getTarget();
           if (task != null) {
  -            parentElement = (TimedElement) tasks.get(task);
  +            parentElement = getTaskElement(task);
           }
           if (parentElement == null && target != null) {
               parentElement = (TimedElement) targets.get(target);
           }
   
  +        /*
           if (parentElement == null) {
               Stack threadStack
                       = (Stack) threadStacks.get(Thread.currentThread());
  @@ -417,6 +443,7 @@
                   }
               }
           }
  +        */
   
           if (parentElement != null) {
               parentElement.element.appendChild(messageElement);
  
  
  

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


Mime
View raw message