Alright, Conor. I will wait for Michael's
feedback and if it is positive, I will apply
this before building beta2 tomorrow.
Cheers,
Magesh
**********************************************
* You are asking for big trouble and a big *
* bill when lawyers are the only ones who *
* understand the law. *
**********************************************
----- Original Message -----
From: "Conor MacNeill" <[EMAIL PROTECTED]>
To: "Ant Developers List" <[EMAIL PROTECTED]>
Sent: Friday, May 31, 2002 9:28 AM
Subject: Re: A logger issue
> Michael Zhou wrote:
> > Hi,
> >
> >
> > # ant -projecthelp
> > The console output is:
> >
> > Buildfile: build.xml
> > Main targets:
> >
> > test ???????
> >
> > Default target: test
> >
> > That is because these messages are output by calling System.out.println,
> > and in turn captured and forwared by ant. The problem is that the
> > System.out/System.err converts the Non-English characters to "?" BEFORE
> > forward these messages to logger handler!
> >
> > It's a big problem to me!
> >
> > Why not use PrintWriter instead of PrintStream? It's more natural to
> > Unicode and Java.
> >
> >
>
> Michael, Can you try the attached patch (against 1.5 Branch). I think it
> should give you the behaviour you desire. Please test and let me know.
>
> If it is OK, I'll leave it up to Magesh to decide whether to apply and
> include in the second beta, otherwise I'll commiy after the beta2 is built
> and it will make the final build.
>
> Conor
>
>
>
>
>
>
----------------------------------------------------------------------------
----
> Index: src/main/org/apache/tools/ant/Main.java
> ===================================================================
> RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
> retrieving revision 1.65.2.1
> diff -3 -u -w -p -r1.65.2.1 Main.java
> --- src/main/org/apache/tools/ant/Main.java 7 May 2002 15:11:24 -0000
1.65.2.1
> +++ src/main/org/apache/tools/ant/Main.java 31 May 2002 13:23:16 -0000
> @@ -806,7 +806,7 @@ public class Main {
> */
> private static void printDescription(Project project) {
> if (project.getDescription() != null) {
> - System.out.println(project.getDescription());
> + project.log(project.getDescription());
> }
> }
>
> @@ -850,20 +850,21 @@ public class Main {
> }
> }
>
> - printTargets(topNames, topDescriptions, "Main targets:",
maxLength);
> + printTargets(project, topNames, topDescriptions, "Main targets:",
> + maxLength);
> //if there were no main targets, we list all subtargets
> //as it means nothing has a description
> if(topNames.size()==0) {
> printSubTargets=true;
> }
> if (printSubTargets) {
> - printTargets(subNames, null, "Subtargets:", 0);
> + printTargets(project, subNames, null, "Subtargets:", 0);
> }
>
> String defaultTarget = project.getDefaultTarget();
> if (defaultTarget != null && !"".equals(defaultTarget)) {
> // shouldn't need to check but...
> - System.out.println("Default target: " + defaultTarget);
> + project.log("Default target: " + defaultTarget);
> }
> }
>
> @@ -905,8 +906,9 @@ public class Main {
> * position so they line up (so long as the names
really
> * <i>are</i> shorter than this).
> */
> - private static void printTargets(Vector names, Vector descriptions,
> - String heading, int maxlen) {
> + private static void printTargets(Project project,Vector names,
> + Vector descriptions,String heading,
> + int maxlen) {
> // now, start printing the targets and their descriptions
> String lSep = System.getProperty("line.separator");
> // got a bit annoyed that I couldn't find a pad function
> @@ -925,6 +927,6 @@ public class Main {
> }
> msg.append(lSep);
> }
> - System.out.println(msg.toString());
> + project.log(msg.toString());
> }
> }
>
>
----------------------------------------------------------------------------
----
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>