ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 54216] New: replaceregexp with backlash throws StringIndexOutOfBoundsException
Date Wed, 28 Nov 2012 08:32:22 GMT

            Bug ID: 54216
           Summary: replaceregexp with backlash throws
           Product: Ant
           Version: 1.8.3
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
    Classification: Unclassified

The follwing ant code:
<replaceregexp file="FILE.EXT" match="hello" replace="\" />

When the regexp is applied against a file regardless of its name with the text
matching 'hello' or whichever the string is selected as the match, this
Exception will be thrown:

java.lang.StringIndexOutOfBoundsException: String index out of range: 1

It must have something to do with the backlash character escaping. The problem
disappears when applying a replace string escaped as follows:

<replaceregexp file="FILE.EXT" match="hello" replace="\\\\" />

In this case, the replacement is carried out successfully.

The bug won´t manifest itself when the text inside FILE.EXT does not match the
regular expression in the 'match' attribute.

You are receiving this mail because:
You are the assignee for the bug.
View raw message