Fix maven2 path has double hash extension or .asc mix with hash extension parse error #80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The url resource for test:
https://repo1.maven.org/maven2/com/netflix/spectator/spectator-ext-jvm/0.103.0/spectator-ext-jvm-0.103.0.module.md5.asc
Here is the exception log:
2020-10-28 10:57:58,623+0800 WARN [qtp716471188-527] *UNKNOWN org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: GET /maven2/com/netflix/spectator/spectator-ext-jvm/0.103.0/spectator-ext-jvm-0.103.0.module.md5.asc 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:288) at org.sonatype.nexus.repository.maven.MavenPath.main(MavenPath.java:265) at org.sonatype.nexus.repository.maven.internal.Maven2MavenPathParser.isRepositoryMetadata(Maven2MavenPathParser.java:70) at org.sonatype.nexus.repository.maven.internal.orient.MavenProxyFacet.getCacheController(MavenProxyFacet.java:79) at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.fetch(ProxyFacetSupport.java:440) at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.fetch(ProxyFacetSupport.java:402) at org.sonatype.nexus.repository.maven.internal.orient.MavenProxyFacet.fetch(MavenProxyFacet.java:74) at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.doGet(ProxyFacetSupport.java:269) at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.lambda$1(ProxyFacetSupport.java:245) at org.sonatype.nexus.common.io.CooperatingFuture.performCall(CooperatingFuture.java:122) at org.sonatype.nexus.common.io.CooperatingFuture.call(CooperatingFuture.java:64) at org.sonatype.nexus.common.io.ScopedCooperationFactorySupport$ScopedCooperation.cooperate(ScopedCooperationFactorySupport.java:99)
In my opinion, this pr may be the smallest change of code, but maybe not the best solution.
If you have some other ideas, welcome to discuss with me.
I also create a issue at MVN JIRA: https://issues.sonatype.org/browse/NEXUS-25645
Thanks for review.