ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r708584 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/Main.java
Date Tue, 28 Oct 2008 14:32:23 GMT
Author: bodewig
Date: Tue Oct 28 07:32:23 2008
New Revision: 708584

URL: http://svn.apache.org/viewvc?rev=708584&view=rev
Log:
At least try to log the real reason of an error.  PR 26086

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/Main.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=708584&r1=708583&r2=708584&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Oct 28 07:32:23 2008
@@ -278,6 +278,10 @@
    some setups.
    Bugzilla Report 46063.
 
+ * if an error occurs while logging the buildFinished event, the
+   original error is now logged to System.err.
+   Bugzilla Report 25086.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Main.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Main.java?rev=708584&r1=708583&r2=708584&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Main.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Main.java Tue Oct 28 07:32:23 2008
@@ -792,7 +792,21 @@
             throw e;
         } finally {
             if (!projectHelp) {
-                project.fireBuildFinished(error);
+                try {
+                    project.fireBuildFinished(error);
+                } catch (Throwable t) {
+                    // yes, I know it is bad style to catch Throwable,
+                    // but if we don't, we lose valuable information
+                    System.err.println("Caught an exception while logging the"
+                                       + " end of the build.  Exception was:");
+                    t.printStackTrace();
+                    if (error != null) {
+                        System.err.println("There has been an error prior to"
+                                           + " that:");
+                        error.printStackTrace();
+                    }
+                    throw new BuildException(t);
+                }
             } else if (error != null) {
                 project.log(error.toString(), Project.MSG_ERR);
             }



Mime
View raw message