You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by peter reilly <pe...@corvil.com> on 2003/06/05 11:09:30 UTC

Re: Error in [if]-task

I see the problem. 

It is in the TaskAdapter, if the
adapted task throws a build exception,
this is logged at "error" level.
        Method executeM = null;
        try {
            Class c = proxy.getClass();
            executeM = c.getMethod("execute", new Class[0]);
            if (executeM == null) {
                log("No public execute() in " + proxy.getClass(), 
                    Project.MSG_ERR);
                throw new BuildException("No public execute() in " 
                    + proxy.getClass());
            }
            executeM.invoke(proxy, null);
            return; 
        } catch (java.lang.reflect.InvocationTargetException ie) {
            log("Error in " + proxy.getClass(), Project.MSG_ERR);  <<< here 
            Throwable t = ie.getTargetException();
            if (t instanceof BuildException) {
                throw ((BuildException) t);
            } else {
                throw new BuildException(t);
            }
        } catch (Exception ex) {
            log("Error in " + proxy.getClass(), Project.MSG_ERR);  << here
            throw new BuildException(ex);
        }

This I think is incorrect, I will
make a bug report and fix by
setting log level to Debug.

Peter

On Thursday 05 June 2003 09:47, Matthias P. wrote:
> Hi everyone,
>
> in my junit-target i am using the following if-task:
>
>   <target name="test" depends="" description="Run the unit tests."
>           unless="avoid.unittests">
>     <junit printsummary="false"
>            errorProperty="test.failed"
>            failureProperty="test.failed">
>       <classpath>
>         <path refid="test.classpath"/>
>       </classpath>
>       <formatter type="plain" usefile="false"/>
>       <formatter type="xml" usefile="true"/>
>       <batchtest todir="${test.report.data.dir}" >
>         <fileset dir="${test.build.common.dir}" includes="**/*Test.class"/>
>
>         <fileset dir="${test.build.server.dir}" includes="**/*Test.class"/>
>
>         <fileset dir="${test.build.client.dir}" includes="**/*Test.class"/>
>
>       </batchtest>
>     </junit>
>
>     <junitreport todir="${test.report.data.dir}">
>       <fileset dir="${test.report.data.dir}">
>         <include name="TEST-*.xml"/>
>       </fileset>
>       <report format="frames" todir="${test.report.result.dir}"/>
>     </junitreport>
>
>     <if>
>       <istrue value="${test.fails.build}"/>
>       <then>
>         <fail message="Test failed. Check log an/or reports."
> if="test.failed"/>
>       </then>
>     </if>
>
>   </target>
>
> This is working well for me. Build is successfull when test.fails.build is
> false and fails if it is true. But in the logs i got the following message
> when test.fails.build is true:
>
> --snip--
> [junitreport] Transform time: 1322ms
>        [if] Error in class net.sf.antcontrib.logic.IfTask
>
> BUILD FAILED
> file:D:/MIF/Projekte/MIFJavaBuild/Java/build.xml:271: Test failed. Check
> log an/or reports.
> 	at org.apache.tools.ant.taskdefs.Exit.execute(Exit.java:104)
> 	at org.apache.tools.ant.Task.perform(Task.java:341)
> 	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:117)
> 	at org.apache.tools.ant.Task.perform(Task.java:341)
> 	at net.sf.antcontrib.logic.IfTask.execute(Unknown Source)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
>9) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>l.java:25) at java.lang.reflect.Method.invoke(Method.java:324)
> 	at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:147)
> 	at org.apache.tools.ant.Task.perform(Task.java:341)
> 	at org.apache.tools.ant.Target.execute(Target.java:309)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:336)
> 	at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
> 	at org.apache.tools.ant.Main.runBuild(Main.java:609)
> 	at org.apache.tools.ant.Main.start(Main.java:196)
> 	at org.apache.tools.ant.Main.main(Main.java:235)
> --snip--
>
> Why does the if-task write the above error-message in verbose-mode. What
> can i improve?
>
> Thanks,
> Matthias


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Error in [if]-task

Posted by peter reilly <pe...@corvil.com>.
On Thursday 05 June 2003 14:07, Conor MacNeill wrote:
> On Thu, 5 Jun 2003 07:09 pm, peter reilly wrote:
> > I see the problem.
>
> Cool.
>
> Actually, I think we should just get rid of that logging altogether. It
> provides not much useful info and a more useful exception is coming in a
> few milliseconds anyway.
>
> MHO, I don't think you need to open Bug reports for these fixes.

Ok,

Peter.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Error in [if]-task

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
On Thu, 5 Jun 2003 07:09 pm, peter reilly wrote:
> I see the problem.
>

Cool.

Actually, I think we should just get rid of that logging altogether. It 
provides not much useful info and a more useful exception is coming in a few 
milliseconds anyway.

MHO, I don't think you need to open Bug reports for these fixes. 

Conor


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org