You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 26, 2021. It is now read-only.
I have a valid json that I created with this library. I then try to deserialize it back into this EMap.
Expected: The values in the map entries would be EList instances.
Actual: ClassCast exceptions.
The org.emfjson.jackson.databind.deser.EMapDeserializer sees a token that is not START_OBJECT (but rather START_ARRAY) and performs a readValue with Object.class. Jackson does its lookups and concludes a com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer should be used, and this creates an ArrayList at line 840.
The org.eclipse.emf.ecore.util.EcoreEMap runs a setValue on line 270 with the ArrayList value, and this triggers a ClassCastException because this list should have been an EList.
Perhaps do a check for START_ARRAY in EMapDeserializer#57 and treat this differently?
Register EList as a deserialization class for json array
Check in EMapDeserializer if the value is ArrayList and convert it to EList. I think this is a bad solution; more of a band-aid fix for this particular case
Description: I am trying to deserialize an
EMapwithBasicEMap.Entry<String,EList<String>>as its contents.Example of this structure:
{ "myMap": { "someKey": ["a", "b", "c"], "key2": ["a", "b"] } }It uses this construct from Ecore:
I have a valid json that I created with this library. I then try to deserialize it back into this
EMap.Expected: The values in the map entries would be
EListinstances.Actual: ClassCast exceptions.
The
org.emfjson.jackson.databind.deser.EMapDeserializersees a token that is notSTART_OBJECT(but ratherSTART_ARRAY) and performs areadValuewithObject.class. Jackson does its lookups and concludes acom.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializershould be used, and this creates anArrayListat line840.The
org.eclipse.emf.ecore.util.EcoreEMapruns asetValueon line 270 with theArrayListvalue, and this triggers aClassCastExceptionbecause this list should have been anEList.Stacktrace:
Assumed fixes:
START_ARRAYinEMapDeserializer#57and treat this differently?EListas a deserialization class for json arrayEMapDeserializerif the value isArrayListand convert it toEList. I think this is a bad solution; more of a band-aid fix for this particular caseThanks!