ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 18625] New: - <replacetokens>: token with empty value throws IndexOutOfBoundsException
Date Wed, 02 Apr 2003 19:41:36 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18625>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18625

<replacetokens>: token with empty value throws IndexOutOfBoundsException

           Summary: <replacetokens>: token with empty value throws
                    IndexOutOfBoundsException
           Product: Ant
           Version: 1.5.2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: bob@synxis.com


Having a value="" as a token value in the follwoing:

       <loadproperties srcFile="build.properties">
            <filterchain>
                <replacetokens begintoken="(" endtoken=")">
                    <token key="${env.LOGNAME}" value=""/>
                </replacetokens>
            </filterchain>
        </loadproperties>

Throws this exception:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:460)
        at org.apache.tools.ant.filters.ReplaceTokens.read(ReplaceTokens.java:160)
        at org.apache.tools.ant.filters.ReplaceTokens.read(ReplaceTokens.java:196)
        at
org.apache.tools.ant.filters.BaseFilterReader.read(BaseFilterReader.java:123)
        at java.io.Reader.read(Reader.java:100)
        at org.apache.tools.ant.util.FileUtils.readFully(FileUtils.java:793)
        at
org.apache.tools.ant.filters.util.ChainReaderHelper.readFully(ChainReaderHelper.java:238)
        at
org.apache.tools.ant.taskdefs.LoadProperties.execute(LoadProperties.java:139)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:397)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:143)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at org.apache.tools.ant.Main.runBuild(Main.java:609)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)

any other non-zero length string will replace fine. But as you can see from the
loadproperties task, I need an empty string.

Mime
View raw message