Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@jakarta.apache.org Received: (qmail 53329 invoked by uid 500); 19 Sep 2001 14:05:35 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: ant-dev@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 53307 invoked from network); 19 Sep 2001 14:05:35 -0000 Date: 19 Sep 2001 14:19:17 -0000 Message-ID: <20010919141917.10579.qmail@mailweb21.rediffmail.com> MIME-Version: 1.0 To: ant-dev@jakarta.apache.org Subject: Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Replace.java From: "Magesh Umasankar" Content-ID: Content-type: text/plain Content-Description: Body Content-Transfer-Encoding: quoted-printable X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Conor: Does this patch resolve Issue 961? http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3D961 Thanks, Magesh On Wed, 19 Sep 2001 conor@apache.org wrote : >conor 01/09/19 05:10:25 > > Modified: docs/manual/CoreTasks replace.html > src/main/org/apache/tools/ant/taskdefs = >Replace.java > Log: > Add encoding to task so that replace can = >work on double byte > characters > = > Revision Changes Path > 1.4 +5 -0 jakarta-ant/docs/manual/CoreTasks- >/replace.html > = > Index: replace.html > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D- >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/- >replace.html,v > retrieving revision 1.3 > retrieving revision 1.4 > diff -u -w -u -r1.3 -r1.4 > --- replace.html 2001/07/30 13:35:23 1.3 > +++ replace.html 2001/09/19 12:10:25 1.4 > @@ -31,6 +31,11 @@ > multiple files. > > > + encoding > + The encoding of the files upon = >which replace operates. > + No - defaults to default JVM = >encoding > + > + > token > the token which must be = >replaced. > Yes, unless a = >nested replacetoken > = > = > = > 1.16 +21 -4 jakarta-ant/src/main/org/apache/t- >ools/ant/taskdefs/Replace.java > = > Index: Replace.java > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D- >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /home/cvs/jakarta-ant/src/main/org/apache/to- >ols/ant/taskdefs/Replace.java,v > retrieving revision 1.15 > retrieving revision 1.16 > diff -u -w -u -r1.15 -r1.16 > --- Replace.java 2001/07/30 13:35:23 1.15 > +++ Replace.java 2001/09/19 12:10:25 1.16 > @@ -83,6 +83,9 @@ > private int replaceCount; = > private boolean summary =3D false; > = > + /** The encoding used to read and write files - = >if null, uses default */ > + private String encoding =3D null; > + = > //Inner class > public class NestedString { > = > @@ -291,8 +294,13 @@ > } > = > try { > - BufferedReader br =3D new = >BufferedReader(new FileReader(src)); > - BufferedWriter bw =3D new = >BufferedWriter(new FileWriter(temp)); > + Reader fileReader =3D encoding =3D=3D null ? = >new FileReader(src) > + : = >new InputStreamReader(new FileInputStream(src), = >encoding); > + Writer fileWriter =3D encoding =3D=3D null ? = >new FileWriter(src) > + : = >new OutputStreamWriter(new FileOutputStream(src), = >encoding); > + = > + BufferedReader br =3D new = >BufferedReader(fileReader); > + BufferedWriter bw =3D new = >BufferedWriter(fileWriter); > = > // read the entire file into a = >StringBuffer > // size of work buffer may be bigger = >than needed > @@ -354,8 +362,8 @@ > temp.delete(); > } > } catch (IOException ioe) { > - ioe.printStackTrace(); > - throw new BuildException(ioe, location); > + throw new BuildException("IOException in = >" + src + " - " + = > + ioe.getClass() >.getName() + ":" + ioe.getMessage(), ioe, location); > } > } > = > @@ -412,6 +420,15 @@ > createReplaceValue().addText(value); > } > = > + /** > + * Set the file encoding to use on the files = >read and written by replace > + * > + * @param encoding the encoding to use on the = >files > + */ > + public void setEncoding(String encoding) { > + this.encoding =3D encoding; > + } > + = > /** > * Nested element. > */ > = > = > = =