Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 29803 invoked from network); 8 Jan 2002 05:38:20 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 8 Jan 2002 05:38:20 -0000 Received: (qmail 12365 invoked by uid 97); 8 Jan 2002 05:38:26 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 12332 invoked by uid 97); 8 Jan 2002 05:38:25 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 12321 invoked from network); 8 Jan 2002 05:38:25 -0000 Message-ID: <010e01c19806$b02c8d20$0201a8c0@nordwand> From: "Steve Loughran" To: "Ant Developers List" References: <1010442990.28137.ezmlm@jakarta.apache.org> <20020107211609.A8648@acubens.internal.xtera.com> Subject: Re: Replace.java and "\n" Date: Mon, 7 Jan 2002 21:37:49 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ----- Original Message ----- From: "Paul Pantages" To: Sent: Monday, January 07, 2002 7:16 PM Subject: Replace.java and "\n" > Hi all, hello > I am using ant 1.4.1 on Solaris 2.7, j2dsdk 1.3.1 > > I was having trouble replacing a token with a value containing newline > "\n". The replace task was just printing out the two characters > '\' & 'n' instead of newline. > > E.g., > file="filename" > token="#BlaBla" > value="\n#BlaBla" > /> > > Was insertng \n#BlaBla into my file. > > I looked into the source for replace task and at the Replace.processFile() > method. I see where the \n is supposed to be handled at line 325 or so: > ... > String val = stringReplace(value.getText(), "\n", linesep); > String tok = stringReplace(token.getText(), "\n", linesep); > ... > > The prob. is, the "\n" in the replace call is converted to 0x0a, and > of course never matches the characters '\','n' in my token or val. yup > If I switch the replaced string to "\\n", the replace task does what I > expect, i.e., switches the "\n" to the unix newline 0x0a. maybe there is an expectation issue? > > ... > String val = stringReplace(value.getText(), "\\n", linesep); > String tok = stringReplace(token.getText(), "\\n", linesep); nope ... > So.... is this is really a bug or am I missing something obvious...? you are missing something obvious. To put a newline into an xml string you use not \n On the positive note, I am glad that you were willing to go into the source and fix behaviour which did not match your expectation. If you keep that soon you will be finding genuine bugs... -steve -- To unsubscribe, e-mail: For additional commands, e-mail: