AtlasOfLivingAustralia / spatial-portal

[Deprecated] User interface for the spatial portal
http://spatial.ala.org.au
4 stars 7 forks source link

Lists API may have changed in an incompatible way #149

Closed ansell closed 6 years ago

ansell commented 6 years ago

The results from the Lists API may have changed and made this code have issues processing the responses. The symptoms are a set of NullPointerException stacktraces in the log files on ala-maps.

The stacktrace is consistent in each case for different DR's so it isn't localised to a particular result:

2018-02-05 12:12:46:792 CommonData [ERROR] error reading list: dr7904
java.lang.NullPointerException
    at au.org.ala.spatial.util.CommonData.initSpeciesListAdditionalColumns(CommonData.java:1346)
    at au.org.ala.spatial.util.CommonData.refreshCachedData(CommonData.java:228)
    at au.org.ala.spatial.util.CommonData.init(CommonData.java:204)
    at au.org.emii.portal.config.ConfigurationLoaderStage2Impl.load(ConfigurationLoaderStage2Impl.java:96)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.load(ConfigurationLoaderStage1Impl.java:83)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.run(ConfigurationLoaderStage1Impl.java:119)
    at java.lang.Thread.run(Thread.java:745)
2018-02-05 12:12:46:818 CommonData [ERROR] error reading list: dr649
java.lang.NullPointerException
    at au.org.ala.spatial.util.CommonData.initSpeciesListAdditionalColumns(CommonData.java:1346)
    at au.org.ala.spatial.util.CommonData.refreshCachedData(CommonData.java:228)
    at au.org.ala.spatial.util.CommonData.init(CommonData.java:204)
    at au.org.emii.portal.config.ConfigurationLoaderStage2Impl.load(ConfigurationLoaderStage2Impl.java:96)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.load(ConfigurationLoaderStage1Impl.java:83)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.run(ConfigurationLoaderStage1Impl.java:119)
    at java.lang.Thread.run(Thread.java:745)
2018-02-05 12:12:46:844 CommonData [ERROR] error reading list: dr656
java.lang.NullPointerException
    at au.org.ala.spatial.util.CommonData.initSpeciesListAdditionalColumns(CommonData.java:1346)
    at au.org.ala.spatial.util.CommonData.refreshCachedData(CommonData.java:228)
    at au.org.ala.spatial.util.CommonData.init(CommonData.java:204)
    at au.org.emii.portal.config.ConfigurationLoaderStage2Impl.load(ConfigurationLoaderStage2Impl.java:96)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.load(ConfigurationLoaderStage1Impl.java:83)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.run(ConfigurationLoaderStage1Impl.java:119)
    at java.lang.Thread.run(Thread.java:745)
2018-02-05 12:12:46:869 CommonData [ERROR] error reading list: dr650
java.lang.NullPointerException
    at au.org.ala.spatial.util.CommonData.initSpeciesListAdditionalColumns(CommonData.java:1346)
    at au.org.ala.spatial.util.CommonData.refreshCachedData(CommonData.java:228)
    at au.org.ala.spatial.util.CommonData.init(CommonData.java:204)
    at au.org.emii.portal.config.ConfigurationLoaderStage2Impl.load(ConfigurationLoaderStage2Impl.java:96)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.load(ConfigurationLoaderStage1Impl.java:83)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.run(ConfigurationLoaderStage1Impl.java:119)
    at java.lang.Thread.run(Thread.java:745)
2018-02-05 12:12:46:894 CommonData [ERROR] error reading list: dr651
java.lang.NullPointerException
    at au.org.ala.spatial.util.CommonData.initSpeciesListAdditionalColumns(CommonData.java:1346)
    at au.org.ala.spatial.util.CommonData.refreshCachedData(CommonData.java:228)
    at au.org.ala.spatial.util.CommonData.init(CommonData.java:204)
    at au.org.emii.portal.config.ConfigurationLoaderStage2Impl.load(ConfigurationLoaderStage2Impl.java:96)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.load(ConfigurationLoaderStage1Impl.java:83)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.run(ConfigurationLoaderStage1Impl.java:119)
    at java.lang.Thread.run(Thread.java:745)
2018-02-05 12:12:46:919 CommonData [ERROR] error reading list: dr653
java.lang.NullPointerException
    at au.org.ala.spatial.util.CommonData.initSpeciesListAdditionalColumns(CommonData.java:1346)
    at au.org.ala.spatial.util.CommonData.refreshCachedData(CommonData.java:228)
    at au.org.ala.spatial.util.CommonData.init(CommonData.java:204)
    at au.org.emii.portal.config.ConfigurationLoaderStage2Impl.load(ConfigurationLoaderStage2Impl.java:96)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.load(ConfigurationLoaderStage1Impl.java:83)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.run(ConfigurationLoaderStage1Impl.java:119)
    at java.lang.Thread.run(Thread.java:745)
2018-02-05 12:12:46:944 CommonData [ERROR] error reading list: dr654
java.lang.NullPointerException
    at au.org.ala.spatial.util.CommonData.initSpeciesListAdditionalColumns(CommonData.java:1346)
    at au.org.ala.spatial.util.CommonData.refreshCachedData(CommonData.java:228)
    at au.org.ala.spatial.util.CommonData.init(CommonData.java:204)
    at au.org.emii.portal.config.ConfigurationLoaderStage2Impl.load(ConfigurationLoaderStage2Impl.java:96)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.load(ConfigurationLoaderStage1Impl.java:83)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.run(ConfigurationLoaderStage1Impl.java:119)
    at java.lang.Thread.run(Thread.java:745)
2018-02-05 12:12:46:970 CommonData [ERROR] error reading list: dr655
java.lang.NullPointerException
    at au.org.ala.spatial.util.CommonData.initSpeciesListAdditionalColumns(CommonData.java:1346)
    at au.org.ala.spatial.util.CommonData.refreshCachedData(CommonData.java:228)
    at au.org.ala.spatial.util.CommonData.init(CommonData.java:204)
    at au.org.emii.portal.config.ConfigurationLoaderStage2Impl.load(ConfigurationLoaderStage2Impl.java:96)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.load(ConfigurationLoaderStage1Impl.java:83)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.run(ConfigurationLoaderStage1Impl.java:119)
    at java.lang.Thread.run(Thread.java:745)
2018-02-05 12:12:46:995 CommonData [ERROR] error reading list: dr2201
java.lang.NullPointerException
    at au.org.ala.spatial.util.CommonData.initSpeciesListAdditionalColumns(CommonData.java:1346)
    at au.org.ala.spatial.util.CommonData.refreshCachedData(CommonData.java:228)
    at au.org.ala.spatial.util.CommonData.init(CommonData.java:204)
    at au.org.emii.portal.config.ConfigurationLoaderStage2Impl.load(ConfigurationLoaderStage2Impl.java:96)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.load(ConfigurationLoaderStage1Impl.java:83)
    at au.org.emii.portal.config.ConfigurationLoaderStage1Impl.run(ConfigurationLoaderStage1Impl.java:119)
    at java.lang.Thread.run(Thread.java:745)

......

The key code seems to assume that the listName property will be in the JSON, but it isn't a root property in the current version:

https://github.com/AtlasOfLivingAustralia/spatial-portal/blob/master/src/main/java/au/org/ala/spatial/util/CommonData.java#L1346

The API seems to be returning a set of search results, with listName only applying to each individual search result, rather than the overall search result:

E.g, https://lists.ala.org.au/ws/speciesList?druid=dr823

returns the following (not the full result, and doesn't have dr823 in the list here):

{
  "listCount": 661,
  "sort": "listName",
  "order": "asc",
  "max": 25,
  "offset": null,
  "lists": [
    {
      "dataResourceUid": "dr1266",
      "listName": "2 b) Protecting Nationally Significant Threatened Species, Woodlands & Wetlands of North East Victoria - Implementing recovery actions for three EPBC listed species: - Regent Honeyeater, Macquarie Perch and Swainsona recta ",
      "listType": "LOCAL_LIST",
      "dateCreated": "2014-07-31T22:26:43Z",
      "lastUpdated": "2017-02-15T17:33:32Z",
      "username": "glen.johnson@depi.vic.gov.au",
      "fullName": null,
      "itemCount": 3,
      "region": null,
      "category": null,
      "generalisation": null,
      "authority": null,
      "sdsType": null,
      "isAuthoritative": false,
      "isInvasive": false,
      "isThreatened": false
    },
.....
}
adam-collins commented 6 years ago

Moved to specieslist-webapp