foojayio / discoclient

A Java library that makes it easier to access the foojay disco api
Apache License 2.0
6 stars 7 forks source link

NPE due to expired ephemeralId #8

Closed emilianbold closed 3 years ago

emilianbold commented 3 years ago

For the NetBeans plugin I'm seeing

java.lang.NullPointerException
    at io.foojay.api.discoclient.DiscoClient.getPkgInfo(DiscoClient.java:1160)
    at org.netbeans.modules.java.disco.Client.getPkgInfo(Client.java:87)
    at org.netbeans.modules.java.disco.DownloadPanel.lambda$downloadBundle$0(DownloadPanel.java:113)

An expired ephemeralId returns a JSON like:

{
  "value":"c0a94587dd7058aa1a50006dd7aacc206d97d0aa",
  "detail":"Requested ephemeral id cannot be found or is outdated.",
  "supported":"Valid ephemeral id from package."
}

then discoclient tries to exact the filename and fails:

            final String     filename          = packageInfoJson.get(PkgInfo.FIELD_FILENAME).getAsString();
emilianbold commented 3 years ago

PR #10 fixes this.