org.gbif.api.vocabulary.License.UNSPECIFIED
Hi,
I got the following exception when getting a dataset in my Java code:
org.codehaus.jackson.map.JsonMappingException: Can not construct instance of org.gbif.api.vocabulary.License from String value 'unspecified': value not one of declared Enum instance names at [Source: http://api.gbif.org/v1/dataset/7ddf754f-d193-4cc9-b351-99906754a03b; line: 1, column: 18567] (through reference chain: org.gbif.api.model.registry.Dataset["license"])
Because Java Enum is case sensitive, either is necessary to rename the entry to lower case, to change the value to upper case, or provide conversion code in org.gbif.api.vocabulary.License. Or, of course, modify application codes....
Cheers, James
org.codehaus.jackson.map.JsonMappingException: Can not construct instance of org.gbif.api.vocabulary.License from String value 'unspecified': value not one of declared Enum instance names at [Source: http://api.gbif.org/v1/dataset/7ddf754f-d193-4cc9-b351-99906754a03b; line: 1, column: 18567] (through reference chain: org.gbif.api.model.registry.Dataset["license"]) Because Java Enum is case sensitive, either is necessary to rename the entry to lower case, to change the value to upper case, or provide conversion code in org.gbif.api.vocabulary.License.
Ah! org.gbif.api.jackson.LicenseSerde is provided.
Cheers, James
Hi James,
The License was implemented using a Jackson Mixin[1] and is provided in the gbif-common-ws[2] project (version 0.34). Assuming you are using a JVM based language, it is also possible to use the registry-ws-client[3] directly to retrieve Dataset objects.
Kind regards,
Christian
[1] http://www.cowtowncoder.com/blog/archives/2009/08/entry_305.html [2] https://github.com/gbif/gbif-common-ws/blob/master/src/main/java/org/gbif/w s/mixin/LicenseMixin.java [3] https://github.com/gbif/registry/tree/master/registry-ws-client
Hi Christian,
thanks a lot. I tried LicenseMixin bacase of less code. It works for Dataset.
Regerds, James ============================== From: Christian Gendreau cgendreau@gbif.org Subject: Re: [API-users] org.gbif.api.vocabulary.License.UNSPECIFIED Date: Fri, 19 Aug 2016 07:18:54 +0000
Hi James,
The License was implemented using a Jackson Mixin[1] and is provided in the gbif-common-ws[2] project (version 0.34). Assuming you are using a JVM based language, it is also possible to use the registry-ws-client[3] directly to retrieve Dataset objects.
Kind regards,
Christian
[1] http://www.cowtowncoder.com/blog/archives/2009/08/entry_305.html [2] https://github.com/gbif/gbif-common-ws/blob/master/src/main/java/org/gbif/w s/mixin/LicenseMixin.java [3] https://github.com/gbif/registry/tree/master/registry-ws-client
-- Christian Gendreau Software Developer Global Biodiversity Information Facility (GBIF) cgendreau@gbif.org http://www.gbif.org
participants (2)
-
Christian Gendreau
-
Nozomi James Ytow