ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 54216] New: replaceregexp with backlash throws StringIndexOutOfBoundsException
Date Wed, 28 Nov 2012 08:32:22 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=54216

            Bug ID: 54216
           Summary: replaceregexp with backlash throws
                    StringIndexOutOfBoundsException
           Product: Ant
           Version: 1.8.3
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: emmanuel.harguindey@gmail.com
    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.
Mime
View raw message