You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Carsten Ziegeler <cz...@s-und-n.de> on 2004/07/12 08:50:51 UTC

Questions about the CocoonTask class

The CocoonTask class in o.a.c has a javadoc error for
the execute() method:

    /**
     * Do the execution and return a return code.
     *
     * @return the return code from the execute java class if it was
     * executed in a separate VM (fork = "yes").
     *
     * @throws BuildException if required parameters are missing
     */
    public void execute() throws BuildException {
        // FIXME - This is never read
        int err= -1;

This method doesn't return anything, so the javadoc is wrong. It seems
that the original author wanted to return the int "err", but the
signature of execute() (from Ant's Task class) doesn't allow this.
I guess that a BuildException should be thrown?


Carsten 

Carsten Ziegeler 
Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.net/weblogs/rael/


RE: Questions about the CocoonTask class

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Upayavira wrote:
> >
> To be honest, I hadn't got my head around how to handle error 
> conditions within the task. Maybe it should throw a 
> BuildException, but as you observed, I didn't quite know what 
> to do with this error - my Ant knowledge was too shaky (and 
> stil is) to work out exactly what to do. Do you have any 
> ideas of the best way to handle error reporting here?
> 
Hmm, I'm not an Ant expert, but in the tasks I wrote I always
simple threw an exception. In some cases I logged the error
using the Ant logging mechanism as well.

Carsten


Re: Questions about the CocoonTask class

Posted by Upayavira <uv...@upaya.co.uk>.
Carsten Ziegeler wrote:

>The CocoonTask class in o.a.c has a javadoc error for
>the execute() method:
>
>    /**
>     * Do the execution and return a return code.
>     *
>     * @return the return code from the execute java class if it was
>     * executed in a separate VM (fork = "yes").
>     *
>     * @throws BuildException if required parameters are missing
>     */
>    public void execute() throws BuildException {
>        // FIXME - This is never read
>        int err= -1;
>
>This method doesn't return anything, so the javadoc is wrong. It seems
>that the original author wanted to return the int "err", but the
>signature of execute() (from Ant's Task class) doesn't allow this.
>I guess that a BuildException should be thrown?
>  
>
To be honest, I hadn't got my head around how to handle error conditions 
within the task. Maybe it should throw a BuildException, but as you 
observed, I didn't quite know what to do with this error - my Ant 
knowledge was too shaky (and stil is) to work out exactly what to do. Do 
you have any ideas of the best way to handle error reporting here?

The CocoonTask is based upon a simplified Java task, taken from within 
Ant itself, and with references to forking and a lot of other stuff 
removed.

Regards, Upayavira