ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/util DOMElementWriter.java
Date Mon, 17 May 2004 13:43:32 GMT
peterreilly    2004/05/17 06:43:32

  Modified:    src/main/org/apache/tools/ant XmlLogger.java
               src/main/org/apache/tools/ant/util DOMElementWriter.java
  Log:
  better diagnostics from XmlLogger.java
  PR: 28993
  Obtained from: Jesse Glick
  
  Revision  Changes    Path
  1.45      +14 -5     ant/src/main/org/apache/tools/ant/XmlLogger.java
  
  Index: XmlLogger.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/XmlLogger.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- XmlLogger.java	9 Mar 2004 16:47:59 -0000	1.44
  +++ XmlLogger.java	17 May 2004 13:43:32 -0000	1.45
  @@ -116,6 +116,9 @@
           private long startTime;
           /** Element created at the start time. */
           private Element element;
  +        public String toString() {
  +            return element.getTagName() + ":" + element.getAttribute("name");
  +        }
       }
   
       /**
  @@ -178,7 +181,7 @@
                   stream = new FileOutputStream(outFilename);
               }
               out = new OutputStreamWriter(stream, "UTF8");
  -            out.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
  +            out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
               if (xslUri.length() > 0) {
                   out.write("<?xml-stylesheet type=\"text/xsl\" href=\""
                           + xslUri + "\"?>\n\n");
  @@ -209,6 +212,10 @@
               threadStack = new Stack();
               threadStacks.put(Thread.currentThread(), threadStack);
           }
  +        /* For debugging purposes uncomment:
  +        org.w3c.dom.Comment s = doc.createComment("stack=" + threadStack);
  +        buildElement.element.appendChild(s);
  +         */
           return threadStack;
       }
   
  @@ -252,9 +259,9 @@
                   TimedElement poppedStack = (TimedElement) threadStack.pop();
                   if (poppedStack != targetElement) {
                       throw new RuntimeException("Mismatch - popped element = "
  -                            + poppedStack.element
  +                            + poppedStack
                               + " finished target element = "
  -                            + targetElement.element);
  +                            + targetElement);
                   }
                   if (!threadStack.empty()) {
                       parentElement = (TimedElement) threadStack.peek();
  @@ -320,11 +327,13 @@
                   TimedElement poppedStack = (TimedElement) threadStack.pop();
                   if (poppedStack != taskElement) {
                       throw new RuntimeException("Mismatch - popped element = "
  -                            + poppedStack.element + " finished task element = "
  -                            + taskElement.element);
  +                            + poppedStack + " finished task element = "
  +                            + taskElement);
                   }
               }
               tasks.remove(task);
  +        } else {
  +            throw new RuntimeException("Unknown task " + task + " not in " + tasks);
           }
       }
   
  
  
  
  1.25      +6 -0      ant/src/main/org/apache/tools/ant/util/DOMElementWriter.java
  
  Index: DOMElementWriter.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/DOMElementWriter.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- DOMElementWriter.java	9 Mar 2004 16:48:51 -0000	1.24
  +++ DOMElementWriter.java	17 May 2004 13:43:32 -0000	1.25
  @@ -117,6 +117,12 @@
                   out.write(encode(child.getNodeValue()));
                   break;
   
  +            case Node.COMMENT_NODE:
  +                out.write("<!--");
  +                out.write(encode(child.getNodeValue()));
  +                out.write("-->");
  +                break;
  +
               case Node.CDATA_SECTION_NODE:
                   out.write("<![CDATA[");
                   out.write(encodedata(((Text) child).getData()));
  
  
  

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


Mime
View raw message