You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "jaikiran pai (JIRA)" <ji...@apache.org> on 2017/06/02 03:17:04 UTC

[jira] [Commented] (IVY-1475) ivy:cachefileset fails with String index out of range on Windows

    [ https://issues.apache.org/jira/browse/IVY-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16034077#comment-16034077 ] 

jaikiran pai commented on IVY-1475:
-----------------------------------

You are right, this is indeed an issue. If you have caches that don't share a common base directory (which can happen) and if the artifacts resulting from a `resolve` end up across these caches (which is again possible), then there won't be a common base dir that the `fileset` generated by `cachefileset` can use. Given that there can't be a fileset without a base dir, like you say, there isn't really a "fix" for this issue and instead should be noted as a limitation of this task. 

You also note that this task could be deprecated in favour of `ivy:resources` task. Having read its documentation, I think it makes sense to do that. I'll raise a discussion on the ant-dev mailing list to ask for opinions from developers who have more knowledge of the project.

> ivy:cachefileset fails with String index out of range on Windows
> ----------------------------------------------------------------
>
>                 Key: IVY-1475
>                 URL: https://issues.apache.org/jira/browse/IVY-1475
>             Project: Ivy
>          Issue Type: Bug
>          Components: Ant
>    Affects Versions: 2.4.0-RC1
>         Environment: Windows
>            Reporter: Patrice Matignon
>
> On Windows, the ant task <ivy:cachefileset /> can fail with the stack trace below, when the resolve includes artifacts located in separate directories in separate drives (e.g. c:\ivy2/cache/... ; d:\ivy2\cache ).
> The underlying issue is that cachefileset is an ant fileset and as such it requires a base dir.
> Nevertheless, the implementation for this ant task doesn't handle this scenario properly: it attempts to find the common base dir for all the resolved artifacts, except that every time it runs into a conflicting artifacts, it just loses the information and ends up reporting an invalid base dir, which causes a fatal StringIndexOutOfBoundsException later in that task.
> A sample stacktrace (the actual reported index varies):
> C:\src\trunk\build.xml:839: impossible to build ivy cache fileset: java.lang.StringIndexOutOfBoundsException: String index out of range: -24
> 	at java.lang.String.substring(String.java:1937)
> 	at java.lang.String.substring(String.java:1904)
> 	at org.apache.ivy.ant.IvyCacheFileset.getPath(IvyCacheFileset.java:114)
> 	at org.apache.ivy.ant.IvyCacheFileset.doExecute(IvyCacheFileset.java:82)
> 	at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:271)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)