jbangdev / jbang-catalog

Catalog of jbang scripts
55 stars 9 forks source link

Validate the GAECV before processing #9

Open jvanzyl opened 3 years ago

jvanzyl commented 3 years ago

Probably need to perform some basic validation to make sure the input conforms to:

<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>

 jvanzyl$ gavsearch com.fasterxml.jackson.core:jackson-core
Searching for `com.fasterxml.jackson.core:jackson-core` on search.maven.org...
javax.ws.rs.ProcessingException: RESTEASY003145: Unable to find a MessageBodyReader of content-type text/plain and type class gavsearch$MvnSearchResult
    at org.jboss.resteasy.core.interception.jaxrs.ClientReaderInterceptorContext.throwReaderNotFound(ClientReaderInterceptorContext.java:47)
    at org.jboss.resteasy.core.interception.jaxrs.AbstractReaderInterceptorContext.getReader(AbstractReaderInterceptorContext.java:133)
    at org.jboss.resteasy.core.interception.jaxrs.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:75)
    at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:214)
    at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:88)
    at org.jboss.resteasy.specimpl.AbstractBuiltResponse.readEntity(AbstractBuiltResponse.java:262)
    at gavsearch.call(gavsearch.java:81)
    at gavsearch.call(gavsearch.java:44)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1783)
    at picocli.CommandLine.access$900(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2150)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2144)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2108)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1975)
    at picocli.CommandLine.execute(CommandLine.java:1904)
    at gavsearch.main(gavsearch.java:63)
quintesse commented 3 years ago

It's an issue with how we call the API. On their website something like com.fasterxml.jackson.core:jackson-core gets translated to: g:com.fasterxml.jackson.core AND a:jackson-core. The parsing of that is done in their web page, so the API only takes that more complex query syntax. We'll have to fix that.

jvanzyl commented 3 years ago

I just chatted with @maxandersen, I'm happy to submit a PR.

quintesse commented 3 years ago

Btw these are their docs:

By coordinates

Group:

Artifact:

Version:

Packaging:

Classifier:

You can also search in combinations, using the "and" keyword: g:junit and v:4.11

By classes Class name