You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Patrick Beard <be...@netscape.com> on 2000/09/23 20:37:17 UTC

[PATCH] Fix to Main.main()'s error message reporting.

Under JShell, when a tool calls System.exit(), it gets a ThreadDeath 
exception. These exceptions never have a non-null message, so the 
code in Main.main() always prints "null" at the end. Here's a patch 
to fix that.

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.20
diff -c -2 -r1.20 Main.java
*** jakarta-ant/src/main/org/apache/tools/ant/Main.java	2000/09/19 
09:09:23	1.20
--- jakarta-ant/src/main/org/apache/tools/ant/Main.java	2000/09/23 18:34:08
***************
*** 132,136 ****
           }
           catch(Throwable exc) {
!             System.err.println(exc.getMessage());
               System.exit(1);
           }
--- 132,138 ----
           }
           catch(Throwable exc) {
!         	String message = exc.getMessage();
!         	if (message != null)
!                 System.err.println(message);
               System.exit(1);
           }
-- 

// Patrick C. Beard
// Java Runtime Enthusiast -- "Will invoke interfaces for food."
// mailto:beard@netscape.com