[JIRA] (JENKINS-52669) IndexOutOfBoundsException after upgrade to 1.2.3

58 views
Skip to first unread message

vlasta.dolejs@gmail.com (JIRA)

unread,
Jul 20, 2018, 3:07:02 AM7/20/18
to jenkinsc...@googlegroups.com
Vlastimil Dolejš created an issue
 
Jenkins / Bug JENKINS-52669
IndexOutOfBoundsException after upgrade to 1.2.3
Issue Type: Bug Bug
Assignee: Unassigned
Attachments: repository-connector-bug.png
Components: repository-connector-plugin
Created: 2018-07-20 07:06
Environment: Jenkins 2.133
Repository Connector plugin 1.2.4
Priority: Major Major
Reporter: Vlastimil Dolejš

I have Artifact Resolver step configured like this:

After upgrade to 1.2.3 (and also 1.2.4) I get this error when running job:

failed to expand tokens for [Artifact cz.diribet:chystat:jar:executable:2.0.0-SNAPSHOT]
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
 at java.util.ArrayList.rangeCheck(ArrayList.java:657)
 at java.util.ArrayList.get(ArrayList.java:433)
 at org.jvnet.hudson.plugins.repositoryconnector.aether.ReleasedVersionRangeResolver.getLatest(ReleasedVersionRangeResolver.java:181)
 at org.jvnet.hudson.plugins.repositoryconnector.aether.ReleasedVersionRangeResolver.resolveVersionRange(ReleasedVersionRangeResolver.java:134)
 at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:370)
 at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:544)
 at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:544)
 at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:544)
 at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
 at org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
 at org.jvnet.hudson.plugins.repositoryconnector.aether.Aether.resolve(Aether.java:221)
 at org.jvnet.hudson.plugins.repositoryconnector.ArtifactResolver.download(ArtifactResolver.java:217)
 at org.jvnet.hudson.plugins.repositoryconnector.ArtifactResolver.perform(ArtifactResolver.java:154)
 at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
 at hudson.model.Build$BuildExecution.build(Build.java:206)
 at hudson.model.Build$BuildExecution.doRun(Build.java:163)
 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
 at hudson.model.Run.execute(Run.java:1815)
 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
 at hudson.model.ResourceController.execute(ResourceController.java:97)
 at hudson.model.Executor.run(Executor.java:429)
ERROR: Failed to resolve artifact

After downgrade to 1.1.3 everything works without problems.

 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

nirmunair@gmail.com (JIRA)

unread,
Dec 4, 2018, 12:39:02 AM12/4/18
to jenkinsc...@googlegroups.com
Nirmal Kumar commented on Bug JENKINS-52669
 
Re: IndexOutOfBoundsException after upgrade to 1.2.3

Do we have any recent update on this issue? Looks the 1.2 version has some issues with resolving the artifacts.

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

justin.mcmillan@verscend.com (JIRA)

unread,
Feb 12, 2019, 3:20:02 PM2/12/19
to jenkinsc...@googlegroups.com
Justin M commented on Bug JENKINS-52669

I am running into this in a scripted pipeline trying to resolve just one of my artifacts – I have 4 WAR files I am trying to download and deploy, all in the same Nexus repository and same group ID and version. 3 of them can be resolved just fine, but for whatever reason, the 4th one gets this same error, and it's really frustrating that it works for all but one of the applications.

 

I am encountering this on both 1.2.3 and 1.2.4. I tried rolling all the way back to version 1.1.3, but that version does not offer pipeline support, which I need for what I'm trying to accomplish. I am calling the step like so:

artifactResolver artifacts: [artifact(artifactId: "single-sign-on", extension: "war", groupId: "com.foo.bar", targetFileName: "sso.war", version: "15.0.0-SNAPSHOT")], releaseUpdatePolicy: 'always', snapshotUpdatePolicy: 'always', targetDirectory: '.'

 

And receiving the following stacktrace:
failed to expand tokens for [Artifact com.foo.bar:single-sign-on:war::15.0.0-SNAPSHOT]


java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)


at org.jvnet.hudson.plugins.repositoryconnector.aether.ReleasedVersionRangeResolver.getLatest(ReleasedVersionRangeResolver.java:181)
at org.jvnet.hudson.plugins.repositoryconnector.aether.ReleasedVersionRangeResolver.resolveVersionRange(ReleasedVersionRangeResolver.java:134)
at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:370)
at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:544)
at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:544)

at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
at org.jvnet.hudson.plugins.repositoryconnector.aether.Aether.resolve(Aether.java:221)
at org.jvnet.hudson.plugins.repositoryconnector.ArtifactResolver.download(ArtifactResolver.java:217)
at org.jvnet.hudson.plugins.repositoryconnector.ArtifactResolver.perform(ArtifactResolver.java:154)

at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

justin.mcmillan@verscend.com (JIRA)

unread,
Feb 12, 2019, 3:21:02 PM2/12/19
to jenkinsc...@googlegroups.com
Justin M edited a comment on Bug JENKINS-52669
I am running into this in a scripted pipeline trying to resolve just one of my artifacts – I have 4 WAR files I am trying to download and deploy, all in the same Nexus repository and same group ID and version. 3 of them can be resolved just fine, but for whatever reason, the 4th one gets this same error, and it's really frustrating that it works for all but one of the applications.

 

I am encountering this on both 1.2.3 and 1.2.4. I tried rolling all the way back to version 1.1.3, but that version does not offer pipeline support, which I need for what I'm trying to accomplish. I am calling the step like so:
{code:java}
artifactResolver artifacts: [artifact(artifactId: "single-sign-on", extension: "war", groupId: "com.foo.bar", targetFileName: "sso.war", version: "15.0.0-SNAPSHOT")], releaseUpdatePolicy: 'always', snapshotUpdatePolicy: 'always', targetDirectory: '.'
{code}

 

And receiving the following stacktrace:
{code:java}
failed to expand tokens for [Artifact com.foo.bar:single-sign-on:war::15.0.0-SNAPSHOT]
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at org.jvnet.hudson.plugins.repositoryconnector.aether.ReleasedVersionRangeResolver.getLatest(ReleasedVersionRangeResolver.java:181)
at org.jvnet.hudson.plugins.repositoryconnector.aether.ReleasedVersionRangeResolver.resolveVersionRange(ReleasedVersionRangeResolver.java:134)
at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:370)
at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:544)
at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:544)
at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
at org.jvnet.hudson.plugins.repositoryconnector.aether.Aether.resolve(Aether.java:221)
at org.jvnet.hudson.plugins.repositoryconnector.ArtifactResolver.download(ArtifactResolver.java:217)
at org.jvnet.hudson.plugins.repositoryconnector.ArtifactResolver.perform(ArtifactResolver.java:154)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:51)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:48)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source) {code}

dennisl@apache.org (JIRA)

unread,
Feb 14, 2019, 7:42:01 AM2/14/19
to jenkinsc...@googlegroups.com

Justin M Does the problematic artifact have a released version in your repository?

Do the successful artifacts have any released versions in your repository?

justin.mcmillan@verscend.com (JIRA)

unread,
Feb 21, 2019, 8:46:03 AM2/21/19
to jenkinsc...@googlegroups.com
Justin M commented on Bug JENKINS-52669

Yes to both questions – I have found a workaround in that for this specific artifact I can simply use Powershell or wget to pull it down. Not ideal, but it will get the job done.

s.gautrin@orange.fr (JIRA)

unread,
Mar 13, 2019, 11:30:04 AM3/13/19
to jenkinsc...@googlegroups.com

I encountered the same issue recently with one artifact. I got multiple artifacts from a multi-module maven project that are released to nexus by another job, then several similar scripted pipeline jobs for deploying different artifacts, with all of them using an Artifact parameter with the same artifact configured.

With one of them, I encounter this error (whether using the job parameter or a hardcoded version, the configured version in the step being overriden by the job parameter anyway according to the log “Overriding configured version ... with version ... from build parameter”).

The IndexOutOfBoundException itself comes from a mistake in the code in ReleasedVersionRangeResolver : before accessing the first entry in vs collection, there is a check on versions collection instead of the filtered vs collection; with a test on the filtered collection, the method would return null instead of raising an exception, though this would possibly raise an exception down the line anyway. In my case and the OP's though, we should not even enter this method though, as we specify a single version and not a version range: I've yet to identify why in this case I end up there, while I do not with other artifacts.

s.gautrin@orange.fr (JIRA)

unread,
Mar 13, 2019, 12:04:03 PM3/13/19
to jenkinsc...@googlegroups.com
Sébastien Gautrin edited a comment on Bug JENKINS-52669
I encountered the same issue recently with one artifact. I got multiple artifacts from a multi-module maven project that are released to nexus by another job, then several similar scripted pipeline jobs for deploying different artifacts, with all of them using an Artifact parameter with the same artifact configured.

With one of them, I encounter this error (whether using the job parameter or a hardcoded version, the configured version in the step being overriden by the job parameter anyway according to the log “Overriding configured version ... with version ... from build parameter”).

The {{IndexOutOfBoundException}} itself comes from a mistake in the code in [ReleasedVersionRangeResolver|https://github.com/jenkinsci/repository-connector-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/repositoryconnector/aether/ReleasedVersionRangeResolver.java] : before accessing the first entry in {{vs}} collection, there is a check on {{versions}} collection instead of the filtered {{vs}} collection; with a test on the filtered collection, the method would return {{null}} instead of raising an exception, though this would possibly raise an exception down the line anyway. In my case and the OP's though, we should not even enter this method though , as we specify a single version and not a version range: I've yet to identify why in this case I end up there, while I do not with other artifacts.

Edit: I might have found the cause: in the final pom of my artifact, I do have a dependency defined as a range, and the corresponding artifact is not present on the same repository (the artifact I want is on a private repository, the ranged dependency is on central); I cannot confirm yet this is the cause, but it seems likely considering the error occurs within {{Aether.resolve}} and the dependencies collection.

[~vlastimil_dolejs] do you also happen to have a dependency with a version range on the artifact you encounter the error with? (check the {{pom.xml}} of the artifact version on your repository)

However, considering this plugin, we should probably ignore dependencies or the requested artifact, should we not?

s.gautrin@orange.fr (JIRA)

unread,
Mar 15, 2019, 6:24:02 AM3/15/19
to jenkinsc...@googlegroups.com
Sébastien Gautrin edited a comment on Bug JENKINS-52669
I encountered the same issue recently with one artifact. I got multiple artifacts from a multi-module maven project that are released to nexus by another job, then several similar scripted pipeline jobs for deploying different artifacts, with all of them using an Artifact parameter with the same artifact configured.

With one of them, I encounter this error (whether using the job parameter or a hardcoded version, the configured version in the step being overriden by the job parameter anyway according to the log “Overriding configured version ... with version ... from build parameter”).

The {{IndexOutOfBoundException}} itself comes from a mistake in the code in [ReleasedVersionRangeResolver|https://github.com/jenkinsci/repository-connector-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/repositoryconnector/aether/ReleasedVersionRangeResolver.java] : before accessing the first entry in {{vs}} collection, there is a check on {{versions}} collection instead of the filtered {{vs}} collection; with a test on the filtered collection, the method would return {{null}} instead of raising an exception, though this would possibly raise an exception down the line anyway. In my case and the OP's though, we should not even enter this method, as we specify a single version and not a version range: I've yet to identify why in this case I end up there, while I do not with other artifacts.


Edit: I might have found the cause: in the final pom of my artifact, I do have a dependency defined as a range, and the corresponding artifact is not present on the same repository (the artifact I want is on a private repository, the ranged dependency is on central); I cannot confirm yet this is the cause, but it seems likely considering the error occurs within {{Aether.resolve}} and the dependencies collection.

[~vlastimil_dolejs] (and [~justinm89]) do you also happen to have a dependency with a version range on the artifact you encounter the error with? (check the {{pom.xml}} of the artifact version on your repository)


However, considering this plugin, we should probably ignore dependencies or the requested artifact, should we not?

vlasta.dolejs@gmail.com (JIRA)

unread,
Apr 2, 2019, 10:11:04 AM4/2/19
to jenkinsc...@googlegroups.com

I can confirm that the problem is related to the version range. In my case, I don't have direct dependency with version range but there is some transitive dependency in my dependency tree that has version declared as a range. 

I have cloned the plugin source and written unit test for my artifact so I know the details. The problematic dependency in my case is org.webjars.npm:js-tokens:jar:[1.0.1,2)

This dependency can be resolved and there are these versions in repository: [1.0.0, 1.0.1, 2.0.0, 3.0.0, 3.0.1, 3.0.2, 4.0.0].

The problematic part of code is in

ReleasedVersionRangeResolver#resolveVersionRange

on lines 134 and 135.

The 3.0.2 and 4.0.0 is picked as the 

versionsAndUpToDates.latestCandidates

and

versionsAndUpToDates.releaseCandidates

which is then passed to 

getLatest()

but none of these versions satisfy version range constraint which is [1.0.1,2).

So I think there are 2 problems.

1/ The getLatest() method should return null instead of throwing exception if it won't match any version with the version range.
2/ I think we should pass versionsAndUpToDates.versions instead of versionsAndUpToDates.latestCandidates and releaseCandidates to the getLatest() method on lines 134 and 135.

I have created pull request for the first problem: https://github.com/jenkinsci/repository-connector-plugin/pull/37
This will completely resolve the problem because resolving transitive dependencies is not necessary.

jgangemi@gmail.com (JIRA)

unread,
Jun 5, 2019, 9:48:03 AM6/5/19
to jenkinsc...@googlegroups.com

jgangemi@gmail.com (JIRA)

unread,
Jun 5, 2019, 9:48:05 AM6/5/19
to jenkinsc...@googlegroups.com
Jae Gangemi started work on Bug JENKINS-52669
 
Change By: Jae Gangemi
Status: Open In Progress

jgangemi@gmail.com (JIRA)

unread,
Jun 5, 2019, 9:48:07 AM6/5/19
to jenkinsc...@googlegroups.com
Jae Gangemi resolved as Fixed
 
Change By: Jae Gangemi
Status: In Progress Resolved
Resolution: Fixed

jgangemi@gmail.com (JIRA)

unread,
Jun 5, 2019, 9:48:07 AM6/5/19
to jenkinsc...@googlegroups.com

justin.mcmillan@verscend.com (JIRA)

unread,
Jun 6, 2019, 8:35:03 AM6/6/19
to jenkinsc...@googlegroups.com
Justin M commented on Bug JENKINS-52669
 
Re: IndexOutOfBoundsException after upgrade to 1.2.3

Just installed and tested with version 1.2.6 and can confirm that it's working to resolve my artifact. Thanks, Jae.

Reply all
Reply to author
Forward
0 new messages