Browse Source

Instantiate the document in the constructor so that

an event other than build started does not initiate a NPE.
PR: 5538
Reported by: sh@blsun.com (Scott Halstead)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270272 13f79535-47bb-0310-9956-ffa450edef68
master
Stephane Bailliez 23 years ago
parent
commit
cc0e324731
1 changed files with 1 additions and 3 deletions
  1. +1
    -3
      src/main/org/apache/tools/ant/XmlLogger.java

+ 1
- 3
src/main/org/apache/tools/ant/XmlLogger.java View File

@@ -101,7 +101,7 @@ public class XmlLogger implements BuildListener {
private final static String ERROR_ATTR = "error";
private final static String STACKTRACE_TAG = "stacktrace";

private Document doc;
private Document doc = builder.newDocument();
private Hashtable tasks = new Hashtable();
private Hashtable targets = new Hashtable();
private Hashtable threadStacks = new Hashtable();
@@ -121,8 +121,6 @@ public class XmlLogger implements BuildListener {
public void buildStarted(BuildEvent event) {
buildElement = new TimedElement();
buildElement.startTime = System.currentTimeMillis();

doc = builder.newDocument();
buildElement.element = doc.createElement(BUILD_TAG);
}



Loading…
Cancel
Save