ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject ReplaceRegExp task, IndexOutOfBoundsException, an I18N problem
Date Thu, 23 Jan 2003 07:34:48 GMT
Hi, I am a newbie to Ant user ML.

Recently I noticed ReplaceRegExp task has been added at Ant1.5.1. I tried
it and soon found it does not work for a file using Japanese characters.
When I run it, it sais shortly

[replaceregexp] An error occurred processing file: 'filename with Jpanese
char': java.lang.IndexOutOfBoundsException

It works fine for us-ascii files.

I downloaded the Ant1.5.1 source bundle, and looked at
Soon I found that the way the class reads in a file seems not appropriate
for files with 2bytes character encoding.

I made a demo program which reproduces the problem of the original
ReplaceRegExp, and also proposes how to fix it. Here I attached a ZIP file
here where you can find the demo source, sample data, and bat script. When
you ran the demo.ReplaceRegExpRefactoring class from commandline, you will
see following messages :

... invoked doReplaceAsOriginal(etc\data_us-ascii.txt)

... invoked doReplaceI18N(etc\data_us-ascii.txt)

... invoked doReplaceAsOriginal(etc\data_jp-Shift_JIS.txt)
... invoked doReplaceI18N(etc\data_jp-Shift_JIS.txt)

I used Ant 1.5.1 on Windows2000,JDK1.3.1-05.

I appreciate the ReplaceRegExp task very much. I want to use it to
preprosess JSP files chompping of the whitespaces for code readability in
order to shorten the JSP response message size. My JSP contains lots of
Japanese chars hence the above mentioned problem is significant for me.

     Thank you in advance.

     MATSUHASHI, kazuaki (FAMILY,given)

(See attached file: AntReplaceRegExpI18Nproblem.ZIP)

View raw message