Return-Path: Mailing-List: contact user-help@ant.apache.org; run by ezmlm Delivered-To: mailing list user@ant.apache.org Received: (qmail 85057 invoked from network); 10 Apr 2003 14:05:08 -0000 Received: from h001.c000.snv.cp.net (HELO c000.snv.cp.net) (209.228.32.65) by daedalus.apache.org with SMTP; 10 Apr 2003 14:05:08 -0000 Received: (cpmta 26251 invoked from network); 10 Apr 2003 07:05:10 -0700 Received: from 128.143.104.108 (HELO ehatchersolutions.com) by smtp.hatcher.net (209.228.32.65) with SMTP; 10 Apr 2003 07:05:10 -0700 X-Sent: 10 Apr 2003 14:05:10 GMT Date: Thu, 10 Apr 2003 10:05:09 -0400 Subject: Re: RE : Accessing getMessage() method of echo task from listener ? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Mime-Version: 1.0 (Apple Message framework v551) From: Erik Hatcher To: "Ant Users List" Content-Transfer-Encoding: quoted-printable In-Reply-To: <0003E227F36E954E8925433257D18F3384D491@fr-s-ples-exch5.eu.corp.airliquide.com> Message-Id: <70C3587D-6B5D-11D7-9718-000393A564E6@ehatchersolutions.com> X-Mailer: Apple Mail (2.551) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Use getMessage in the messageLogged event, not in taskFinished. You'll=20= have to implement a simple state machine if you want to trigger it only=20= on the task. Erik On Thursday, April 10, 2003, at 09:58 AM, ALIA-SC, David wrote: > Yep, but it throws an nullpointerexception when I try to use the > event.getMessage() method ! > > This is the beginning of my code (the principal lines) : > > public void taskFinished(BuildEvent event) { > // filtering... > if (event.getTask().getTaskName().equalsIgnoreCase(ECHO_TASK)) { > // the next line does not work --> null pointer = exception is > raised ?? > String tmpMessage =3D event.getMessage(); > ... > log.warn(tmpMessage); > } > } > > David > > > -----Message d'origine----- > De : Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] > Envoy=E9 : jeudi 10 avril 2003 15:36 > =C0 : user@ant.apache.org > Objet : AW: Accessing getMessage() method of echo task from listener ? > > > A quick look into the source ... BuildEvent would help you: > > > Returns the project that fired this event. > public Project getProject() > > Returns the target that fired this event. > public Target getTarget() > > Returns the task that fired this event. > public Task getTask() > > Returns the logging message. This field will only be set for=20 > "messageLogged" > events. > public String getMessage() > > Returns the priority of the logging message. This field will only be=20= > set for > "messageLogged" events. The meaning of this priority is as specified=20= > by the > constants in the {@link Project Project} class. > public int getPriority() > > Returns the exception that was thrown, if any. This field will only be=20= > set > for "taskFinished", "targetFinished", and "buildFinished" events. > public Throwable getException() > > > > Jan Mat=E8rne > >> -----Urspr=FCngliche Nachricht----- >> Von: ALIA-SC, David [mailto:David.ALIA-SC@AirLiquide.com] >> Gesendet am: Donnerstag, 10. April 2003 15:30 >> An: Ant Users List >> Betreff: Accessing getMessage() method of echo task from listener ? >> >> Hmm... >> >> I want to have my listener more and more effective (thanks to >> Jan Materne, >> i've finally managed to have it work fine :)). >> >> In the taskFinished(BuildEvent event) method, I want to log >> the message >> attribute of an task (filtering tasks is easy). >> >> But how can I get the echoed message into my java code ? >> Do I have to use the getMessage() of this task ? >> >> David >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org >> For additional commands, e-mail: user-help@ant.apache.org >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > For additional commands, e-mail: user-help@ant.apache.org > >