From dev-return-60072-apmail-ant-dev-archive=ant.apache.org@ant.apache.org Thu Sep 02 07:52:12 2004 Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 72945 invoked from network); 2 Sep 2004 07:52:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Sep 2004 07:52:12 -0000 Received: (qmail 50567 invoked by uid 500); 2 Sep 2004 07:52:08 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 50498 invoked by uid 500); 2 Sep 2004 07:52:06 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 50482 invoked by uid 99); 2 Sep 2004 07:52:06 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from [65.61.166.71] (HELO rs15.luxsci.com) (65.61.166.71) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 02 Sep 2004 00:52:02 -0700 Received: from [192.168.1.4] (adsl-49-176.swiftdsl.com.au [218.214.49.176]) (authenticated bits=0) by rs15.luxsci.com (8.12.11/8.12.10) with ESMTP id i827pvWx027281 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Thu, 2 Sep 2004 02:51:59 -0500 Message-ID: <4136D18C.7010206@cortexebusiness.com.au> Date: Thu, 02 Sep 2004 17:53:48 +1000 From: Conor MacNeill User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ant Developers List Subject: Re: Integrating own BuildLogger References: <200409012353.45275.robert@enough.de> In-Reply-To: <200409012353.45275.robert@enough.de> X-Enigmail-Version: 0.84.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Robert Virkus wrote: > Hi everyone, > > I am trying to substitute the original build logger in my task with Ant 1.6.1. > I have written a wrapper-class which just forwards the events to the original > build logger, which works fine as long as I don't try to modify the build > events. When I change a build event, however, Ant is stopping the execution > with the message "BUILD FAILED > Listener attempted to access System.out - infinite loop terminated" > This is an interesting problem. Nothing you're doing sounds like a problem but somewhere something in your message handling is attempting to output a message. i.e. before one message has been delivered to the listeners something is attempting to send another. The message above gives the most common cause but it is in fact not the only possibility as I found when trying to sort out your problem. Since your logger is loaded by an AntClassLoader it is susceptible to any logging done by that classloader. In fact I reproduced your problem and here is the stack trace Listener attempted to access System.out - infinite loop terminated at org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:1991) at org.apache.tools.ant.Project.fireMessageLogged(Project.java:2020) at org.apache.tools.ant.Project.log(Project.java:387) at org.apache.tools.ant.AntClassLoader.log(AntClassLoader.java:394) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:974) at java.lang.ClassLoader.loadClass(ClassLoader.java:236) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:303) at PolishLogger.messageLogged(PolishLogger.java:32) So the deferred classloading that is triggered in your messageLogged method causes the AntClassLoader to log a message (a class being loaded). The workaround is to trigger the class loading earlier. I changed the PolishLogger constructor as follows: public PolishLogger(BuildLogger realLogger, Project project) { this.logger = realLogger; BuildEvent event = new BuildEvent(project); String s = new String(); StringBuffer sb = new StringBuffer(); } Note that it is not easy to ensure you have got all the classes loaded. A better solution might be to not load the PolishLogger through the AntClassLoader. Conor --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org