ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gle...@ca.ibm.com
Subject [PATCH] Missing listener class exception not trapped properly.
Date Sat, 15 Jul 2000 20:59:28 GMT




I was playing with the XmlLogger and misspelled it.  My build finished
almost instantly, with no discernable error message.  It seems that the
method which adds the build listeners and throws an exception when it finds
one, is sitting outside of the try/finally block that traps the build
exceptions and generates a valid error message.

The patch is a small change to Main.java and DefaultLogger.java.  If you
don't set DefaultLogger.startTime when the class is created, the elapsed
time message is just screwy.

Index: jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java,v

retrieving revision 1.3
diff -u -r1.3 DefaultLogger.java
--- jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java
2000/07/12 10:46:11        1.3
+++ jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java
2000/07/15 20:54:27
@@ -66,7 +66,7 @@

     private PrintStream out;
     private int msgOutputLevel;
-    private long startTime;
+    private long startTime = System.currentTimeMillis();

     /**
      *  Constructs a new logger which will write to the specified
Index: jakarta-ant/src/main/org/apache/tools/ant/Main.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
retrieving revision 1.11
diff -u -r1.11 Main.java
--- jakarta-ant/src/main/org/apache/tools/ant/Main.java        2000/07/03
12:10:26        1.11
+++ jakarta-ant/src/main/org/apache/tools/ant/Main.java        2000/07/15
20:54:27
@@ -238,12 +238,11 @@
         }

         Project project = new Project();
-        addBuildListeners(project);
-        project.fireBuildStarted();
-
         Throwable error = null;

         try {
+            addBuildListeners(project);
+            project.fireBuildStarted();
             project.init();

             // set user-define properties

Glenn McAllister
TID - Software Developer - VisualAge for Java
IBM Toronto Lab, (416) 448-3805
"An approximate answer to the right question is better than the
right answer to the wrong question." - John W. Tukey



Mime
View raw message