You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/04/01 22:07:01 UTC
DO NOT REPLY [Bug 44731] New: StringIndexOutOfBoundsException thrown
by <
move> with glob
https://issues.apache.org/bugzilla/show_bug.cgi?id=44731
Summary: StringIndexOutOfBoundsException thrown by <move> with
glob <mapper>
Product: Ant
Version: 1.7.0
Platform: PC
OS/Version: Linux
Status: NEW
Severity: major
Priority: P2
Component: Core tasks
AssignedTo: notifications@ant.apache.org
ReportedBy: archie@dellroad.org
Creating and executing the following file causes ant to throw an exception:
$ cat > bug2.xml
<project name="bug" default="bug">
<target name="bug">
<delete dir="src"/>
<delete dir="dst"/>
<mkdir dir="src"/>
<touch file="src/foobar-1.2.3.jar"/>
<touch file="src/foobar-janfu-1.2.3.jar"/>
<mkdir dir="dst"/>
<move todir="dst">
<fileset dir="src">
<include name="**/*.jar"/>
</fileset>
<mapper type="glob" from="foobar-*-1.2.3.jar" to="*.jar"/>
</move>
</target>
</project>
$ ant -v -f bug2.xml
Apache Ant version 1.7.0 compiled on September 22 2007
Buildfile: bug2.xml
Detected Java version: 1.5 in: /usr/lib/jvm/java-1.5.0-sun-1.5.0_13-sr2/jre
Detected OS: Linux
parsing buildfile /home/archie/home.svn/hogwash/oss/jetty/6.1.9/bug2.xml with
URI = file:/home/archie/home.svn/hogwash/oss/jetty/6.1.9/bug2.xml
Project base dir set to: /home/archie/home.svn/hogwash/oss/jetty/6.1.9
Build sequence for target(s) `bug' is [bug]
Complete build sequence is [bug, ]
bug:
[antlib:org.apache.tools.ant] Could not load definitions from resource
org/apache/tools/ant/antlib.xml. It could not be found.
[delete] Deleting directory
/home/archie/home.svn/hogwash/oss/jetty/6.1.9/src
[delete] Deleting
/home/archie/home.svn/hogwash/oss/jetty/6.1.9/src/foobar-janfu-1.2.3.jar
[delete] Deleting
/home/archie/home.svn/hogwash/oss/jetty/6.1.9/src/foobar-1.2.3.jar
[delete] Deleting directory
/home/archie/home.svn/hogwash/oss/jetty/6.1.9/src
[delete] Deleting directory
/home/archie/home.svn/hogwash/oss/jetty/6.1.9/dst
[delete] Deleting directory
/home/archie/home.svn/hogwash/oss/jetty/6.1.9/dst
[mkdir] Created dir: /home/archie/home.svn/hogwash/oss/jetty/6.1.9/src
[touch] Creating
/home/archie/home.svn/hogwash/oss/jetty/6.1.9/src/foobar-1.2.3.jar
[touch] Creating
/home/archie/home.svn/hogwash/oss/jetty/6.1.9/src/foobar-janfu-1.2.3.jar
[mkdir] Created dir: /home/archie/home.svn/hogwash/oss/jetty/6.1.9/dst
BUILD FAILED
/home/archie/home.svn/hogwash/oss/jetty/6.1.9/bug2.xml:9:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of
range: -1
at java.lang.String.substring(String.java:1768)
at
org.apache.tools.ant.util.GlobPatternMapper.extractVariablePart(GlobPatternMapper.java:150)
at
org.apache.tools.ant.util.GlobPatternMapper.mapFileName(GlobPatternMapper.java:138)
at org.apache.tools.ant.taskdefs.Copy.buildMap(Copy.java:682)
at org.apache.tools.ant.taskdefs.Copy.scan(Copy.java:644)
at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:528)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
... 11 more
--- Nested Exception ---
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1768)
at
org.apache.tools.ant.util.GlobPatternMapper.extractVariablePart(GlobPatternMapper.java:150)
at
org.apache.tools.ant.util.GlobPatternMapper.mapFileName(GlobPatternMapper.java:138)
at org.apache.tools.ant.taskdefs.Copy.buildMap(Copy.java:682)
at org.apache.tools.ant.taskdefs.Copy.scan(Copy.java:644)
at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:528)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Total time: 1 second
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 44731] StringIndexOutOfBoundsException thrown by
with glob
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44731
Peter Reilly <pe...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #1 from Peter Reilly <pe...@apache.org> 2008-04-01 13:32:41 PST ---
Confirmed on trunk and in 1.7.1 beta
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 44731] StringIndexOutOfBoundsException thrown by
with glob
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44731
Peter Reilly <pe...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |1.8.0
--- Comment #2 from Peter Reilly <pe...@apache.org> 2008-04-02 13:39:32 PST ---
Thanks for the example/complete build file. This is great for tracking
down bugs...!!!
The problem here is that the src/foobar-1.2.3.jar file
should not match the filter - the prefix and postfix overlap,
resulting in bug.
Fixed in trunk.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.