jbang-catalog icon indicating copy to clipboard operation
jbang-catalog copied to clipboard

Validate the GAECV before processing

Open jvanzyl opened this issue 4 years ago • 3 comments

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)

jvanzyl avatar Sep 06 '21 15:09 jvanzyl

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.

quintesse avatar Sep 07 '21 16:09 quintesse

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

jvanzyl avatar Sep 07 '21 16:09 jvanzyl

Btw these are their docs:

By coordinates

Group:

  • g:junit

Artifact:

  • a:junit

Version:

  • v:4.11

Packaging:

  • p:jar
  • p:war

Classifier:

  • l:sources
  • l:javadocs

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

By classes Class name

  • c:JUnit4 Full class name
  • fc:org.sonatype.nexus By checksums SHA-1
  • 1:2973d150c0dc1fefe998f834810d68f278ea58ec

quintesse avatar Sep 07 '21 16:09 quintesse