mthmulders / mcs

Search the Maven Central Repository from your command line!

Home Page:https://maarten.mulders.it/projects/mcs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

java.lang.IndexOutOfBoundsException: start 0, end -12, length 12 when searching "spring-data"

jludvice opened this issue · comments

Hello, for some reason this is not working

 mcs search spring-data-jpa  
Searching for spring-data-jpa...
Found 56 results

java.lang.IndexOutOfBoundsException: start 0, end -12, length 12
        at java.lang.AbstractStringBuilder.checkRange(AbstractStringBuilder.java:1802)
        at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:680)
        at java.lang.StringBuilder.append(StringBuilder.java:214)
        at picocli.CommandLine$Help$Ansi$Text.getStyledChars(CommandLine.java:17711)
        at picocli.CommandLine$Help$TextTable.copy(CommandLine.java:16856)
        at picocli.CommandLine$Help$TextTable.copy(CommandLine.java:16845)
        at picocli.CommandLine$Help$TextTable.putValue(CommandLine.java:16807)
        at picocli.CommandLine$Help$TextTable.addRowValues(CommandLine.java:16739)
        at picocli.CommandLine$Help$TextTable.addRowValues(CommandLine.java:16720)
        at it.mulders.mcs.search.TabularOutputPrinter.print(TabularOutputPrinter.java:36)
        at it.mulders.mcs.search.DelegatingOutputPrinter.print(DelegatingOutputPrinter.java:29)
        at it.mulders.mcs.search.SearchCommandHandler.printResponse(SearchCommandHandler.java:59)
        at it.mulders.mcs.common.Result$Success.ifPresent(Result.java:20)
        at it.mulders.mcs.search.SearchCommandHandler.performWildcardSearch(SearchCommandHandler.java:30)
        at it.mulders.mcs.search.SearchCommandHandler.search(SearchCommandHandler.java:23)
        at it.mulders.mcs.cli.Cli$SearchCommand.call(Cli.java:49)
        at it.mulders.mcs.cli.Cli$SearchCommand.call(Cli.java:32)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at it.mulders.mcs.App.doMain(App.java:17)
        at it.mulders.mcs.App.main(App.java:10)

but different search works

mcs search 'org.springframework.data:spring-data-jpa*'
Searching for org.springframework.data:spring-data-jpa*...

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>2.6.1</version>
    </dependency>

environment:

 java -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment 21.9 (build 17.0.1+12)
OpenJDK 64-Bit Server VM 21.9 (build 17.0.1+12, mixed mode, sharing)


mcs --version
mcs v0.1.18

Thank you for taking the time to report this!

The code has a hard limit for the width of the table (120 characters) but some of the artifacts in Central that match your query have longer coordinates: the longest being 127 characters. This lead to the "timestamp" column being -12 characters long.

The next version of mcs will have this fixed.

Impressive response time :)

Thanks for the fix @mthmulders