Issue 10478

Investigate why Jackson will not serialize TaxonomicCoverage with InterpretedEnum

10478
Reporter: trobertson
Assignee: kbraak
Type: Bug
Summary: Investigate why Jackson will not serialize TaxonomicCoverage with InterpretedEnum
Priority: Minor
Resolution: Fixed
Status: Closed
Created: 2011-12-06 18:02:30.391
Updated: 2013-12-16 17:50:19.064
Resolved: 2012-02-29 18:21:03.795
        
Description: TaxonomicCoverage has had the rank (an interpretedenum) commented out as it will not deserialize.

Any object with an InterpretedEnum will serialize to JSON, but will not deserialize.  See the attached files illustrating this, which can be run in the registry-api project

Serialized dataset: {"key":"k"}
java.lang.ArrayIndexOutOfBoundsException: 1
	at org.codehaus.jackson.map.introspect.AnnotatedWithParams.getParameter(AnnotatedWithParams.java:138)
	at org.codehaus.jackson.map.introspect.POJOPropertiesCollector._addCreators(POJOPropertiesCollector.java:365)]]>
    
Attachment EnumTest.java
Attachment KVP.java
Attachment MarshallTest.java
Attachment RankCopy.java


Author: lfrancke@gbif.org
Comment: Fixed upstream in https://jira.codehaus.org/browse/JACKSON-701 in the next released version.
Created: 2011-12-20 11:25:36.275
Updated: 2011-12-20 11:25:36.275


Author: trobertson@gbif.org
Created: 2012-01-24 11:33:18.632
Updated: 2012-01-24 11:33:18.632
        
http://jackson.codehaus.org/

1.9.4 was released on 20th Jan and JACKSON-701 claims it is fixed in there.  Need to retest
    


Author: kbraak@gbif.org
Created: 2012-01-24 15:28:48.006
Updated: 2012-01-24 15:28:48.006
        
Re-testing with 1.9.4 using the above test classes, I now get the following error on deserialization:

java.lang.IllegalStateException: Internal error: constructor for org.gbif.api.model.vocabulary.Rank has mismatch: 3 parameters; 1 sets of annotations

This is a bug that is claimed to be fixed already, but from my tests it isn't.

Try running the test using the attached files (EnumTest.java and RankCopy.java - removing the annotation @Nonnull from RankCopy gets things to work - even though this should have been fixed by 1.9.3 as per the Jackson issue marked as resolved).
    


Author: kbraak@gbif.org
Comment: Files for further testing added
Created: 2012-01-24 15:30:22.334
Updated: 2012-01-24 15:30:22.334


Author: lfrancke@gbif.org
Comment: The bug Kyle mentioned: http://jira.codehaus.org/browse/JACKSON-757
Created: 2012-01-24 15:32:14.919
Updated: 2012-01-24 15:32:14.919


Author: kbraak@gbif.org
Comment: Use InterpretedEnum<String, Language> awaits resolution of this issue
Created: 2012-01-24 16:22:11.993
Updated: 2012-01-24 16:22:11.993


Author: kbraak@gbif.org
Created: 2012-01-27 11:21:40.738
Updated: 2012-01-27 11:21:40.738
        
So a the Jackson issue has been fixed but now awaits release in 1.9.5. The get InterpretedEnum working, the annotation is being removed temporarily until the new release is made.

REG-88 and REG-86 are actually working now, so I will remove those blocks now.
    


Author: kbraak@gbif.org
Comment: Basically just awaiting the latest release now, so downgrading its priority to 'minor'.
Created: 2012-02-02 10:54:51.949
Updated: 2012-02-02 10:54:51.949


Author: kbraak@gbif.org
Created: 2012-02-29 18:21:03.824
Updated: 2012-02-29 18:21:03.824
        
All projects upgraded to 1.9.5 and annotation added back to Rank enum.

Closing issue.