ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: Error in [if]-task
Date Thu, 05 Jun 2003 09:09:30 GMT
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


Mime
View raw message