commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cyrille Le Clerc (JIRA)" <commons-...@jakarta.apache.org>
Subject [jira] Updated: (JELLY-209) Ant tags do not redirect stderr ou stdout to Ant tag
Date Sat, 16 Apr 2005 23:45:57 GMT
     [ http://issues.apache.org/jira/browse/JELLY-209?page=history ]

Cyrille Le Clerc updated JELLY-209:
-----------------------------------

    Attachment: a-path-for-JELLY-209-commons-jelly-tags-ant-1.0.jar

Jar to patch the stdout & stderr not redirected to Ant tag.

The jar name is prefixed by "a-" to be loaded before commons-jelly-tags-ant-1.0.jar by the
application classloader thanks to alphabetical sort (e.g. you can copy this jar in $MAVEN_HOME/lib).

This jar contains both AntTag.class and AntTag.java.


> Ant tags do not redirect stderr ou stdout to Ant tag
> ----------------------------------------------------
>
>          Key: JELLY-209
>          URL: http://issues.apache.org/jira/browse/JELLY-209
>      Project: jelly
>         Type: Bug
>   Components: taglib.ant
>     Versions: 1.0
>  Environment: Sun JDK 1.4.2_07, commons-jelly-1.0-RC1.jar, commons-jelly-tags-ant-1.0.jar
>     Reporter: Cyrille Le Clerc
>  Attachments: AntTag.java.diff, a-path-for-JELLY-209-commons-jelly-tags-ant-1.0.jar
>
> Ant tag (org.apache.commons.jelly.tags.ant.AntTag) does not redirect System.out and System.err
to the target Ant tag (through the Ant Project). Due to this, System.out and System.err are
not handled by Ant tasks (e.g. JunitTask should output in TEST-xxx.xml stdout and stderr).
> Sample of code to redirect stdout and stderr in org.apache.tools.ant.Main#runBuild(ClassLoader),
version 1.6.2 :
>   System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
>   System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
> Patch :
> To patch this problem, I modified org.apache.commons.jelly.tags.ant.AntTag to redirect
stdout and stderr before calling "task.perform()" and, after the task execution, reset stdout
an stderr to their initial values.
> Diff of org.apache.commons.jelly.tags.ant.AntTag
> (It does not seem to be possible to attach files in Jira)
> Index: AntTag.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-commons/jelly/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant/AntTag.java,v
> retrieving revision 1.34
> diff -r1.34 AntTag.java
> 18a19
> > import java.io.PrintStream;
> 36a38
> > import org.apache.tools.ant.DemuxOutputStream;
> 185c187,199
> <                 task.perform();
> ---
> >                 // according to org.apache.tools.ant.Main, redirect stdout and stderr
> >                 PrintStream initialOut = System.out;
> >                 PrintStream initialErr = System.err;
> >                 PrintStream newOut = new PrintStream(new DemuxOutputStream(project,
false));
> >                 PrintStream newErr = new PrintStream(new DemuxOutputStream(project,
true));
> >                 try{
> >                     System.setOut(newOut);
> >                     System.setErr(newErr);
> >                     task.perform();
> >                 } finally {
> >                     System.setOut(initialOut);
> >                     System.setErr(initialErr);
> >                 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


Mime
View raw message