PUT returns error and logs "String index out of range: -1"

We’ve recently started receiving an error with a maven repository after a PUT operation. The artifact is uploaded, but an error is returned. We’re using the Gradle maven-publish plugin. It is working with all other repositories. The problem began using Nexus 3.29.1 and I have since upgraded to 3.29.2-02 and rebuilt the repository index.

The Nexus log:

2021-01-14 19:33:43,628+0000 WARN [qtp603976239-164] build-agent-development org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: PUT /repository/prodops-candidates/org/syntech/operations/syntech_prod_ops_emb_zero/1.0.14-SNAPSHOT/syntech_prod_ops_emb_zero-1.0.14-20210114.193340-4.tar.gz.sha256.sha1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1967)
at org.sonatype.nexus.repository.maven.MavenPath.subordinateOf(MavenPath.java:290)
at org.sonatype.nexus.repository.maven.MavenPath.main(MavenPath.java:267)
at org.sonatype.nexus.repository.maven.internal.VersionPolicyHandler.handle(VersionPolicyHandler.java:61)
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
at org.sonatype.nexus.repository.http.PartialFetchHandler.handle(PartialFetchHandler.java:59)
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
at org.sonatype.nexus.repository.view.handlers.ConditionalRequestHandler.handle(ConditionalRequestHandler.java:72)
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
at com.sonatype.nexus.clm.internal.orient.FirewallContributedHandler.handle(FirewallContributedHandler.java:101)
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
at org.sonatype.nexus.repository.view.handlers.HandlerContributor.handle(HandlerContributor.java:67)
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
at org.sonatype.nexus.repository.view.handlers.ExceptionHandler.handle(ExceptionHandler.java:42)
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
at org.sonatype.nexus.repository.routing.internal.RoutingRuleHandler.handle(RoutingRuleHandler.java:52)
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
at org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:51)
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
at org.sonatype.nexus.repository.view.handlers.TimingHandler.handle(TimingHandler.java:58)
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:88)
at org.sonatype.nexus.repository.view.Context.start(Context.java:179)
at org.sonatype.nexus.repository.view.Router.dispatch(Router.java:65)
at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:52)
at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:43)
at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.dispatchAndSend(ViewServlet.java:213)
at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.doService(ViewServlet.java:175)
at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.service(ViewServlet.java:127)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

Hi Brian, are you intending to upload a sha1 hash of a sha256 hashfile ? It seems some changes that went into the maven path matching in 3.29.0 aren’t liking the fact that you are PUTting a hash of a hashfile

1 Like

Thank you. This build was still trying to publish a manually generated sha256 file. Removing that publish attempt corrected the issue.

1 Like

Created https://issues.sonatype.org/browse/NEXUS-26462 for better future handling.

This post was flagged by the community and is temporarily hidden.