eclipse-emfcloud / ecore-glsp

ecore-glsp
Other
32 stars 25 forks source link

Exceptions on ModelServer when the properties view is open #119

Open CamilleLetavernier opened 2 years ago

CamilleLetavernier commented 2 years ago

When updating the ModelServer to fix #115, a new exception is sometimes thrown, if the properties view is open while manipulating the model in GLSP (Mostly when creating new elements):

830670 [SingleThreadModelController 1] ERROR ContextResponse  - An error occurred during data decoding
org.eclipse.emfcloud.modelserver.common.codecs.DecodingException: 
    at org.eclipse.emfcloud.modelserver.common.codecs.DefaultJsonCodec.decode(DefaultJsonCodec.java:62)
    at org.eclipse.emfcloud.modelserver.emf.common.codecs.DICodecsManager.decode(DICodecsManager.java:101)
    at org.eclipse.emfcloud.modelserver.emf.common.DefaultModelController.readPayload(DefaultModelController.java:270)
    at org.eclipse.emfcloud.modelserver.emf.common.DefaultModelController.executeCommand(DefaultModelController.java:284)
    at org.eclipse.emfcloud.modelserver.emf.common.SingleThreadModelController.lambda$13(SingleThreadModelController.java:164)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.eclipse.emfcloud.modelserver.emf.common.SingleThreadModelController.handleAction(SingleThreadModelController.java:88)
    at org.eclipse.emfcloud.modelserver.emf.common.SingleThreadModelController.handleNextAction(SingleThreadModelController.java:82)
    at org.eclipse.emfcloud.modelserver.emf.common.SingleThreadModelController.runThread(SingleThreadModelController.java:68)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.eclipse.emfcloud.jackson.errors.JSONException: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`)
 at [Source: (ByteArrayInputStream); line: 1, column: 283] (through reference chain: org.eclipse.emf.ecore.util.EDataTypeUniqueEList[0])
    ... 11 more
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`)
 at [Source: (ByteArrayInputStream); line: 1, column: 283] (through reference chain: org.eclipse.emf.ecore.util.EDataTypeUniqueEList[0])
    at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
    at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1601)
    at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1375)
    at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1280)
    at com.fasterxml.jackson.databind.deser.std.StdDeserializer._parseString(StdDeserializer.java:1288)
    at com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:216)
    at com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:25)
    at org.eclipse.emfcloud.jackson.databind.property.EObjectFeatureProperty.deserializeAndSet(EObjectFeatureProperty.java:76)
    at org.eclipse.emfcloud.jackson.databind.deser.EObjectDeserializer.deserialize(EObjectDeserializer.java:79)
    at org.eclipse.emfcloud.jackson.databind.deser.EObjectDeserializer.deserialize(EObjectDeserializer.java:38)
    at org.eclipse.emfcloud.jackson.databind.deser.ResourceDeserializer.deserialize(ResourceDeserializer.java:75)
    at org.eclipse.emfcloud.jackson.databind.deser.ResourceDeserializer.deserialize(ResourceDeserializer.java:30)
    at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:324)
    at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:2033)
    at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1426)
    at org.eclipse.emfcloud.jackson.resource.JsonResource.doLoad(JsonResource.java:192)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1563)
    at org.eclipse.emfcloud.modelserver.common.codecs.DefaultJsonCodec.decode(DefaultJsonCodec.java:60)
    ... 10 more

The Json message that causes the exception (not visible in the exception) seems valid to me:

{"type":"set","eClass":"http://www.eclipse.org/emfcloud/modelserver/command#//Command","owner":{"$ref":"file:/home/camille/Git/ecore-glsp/client/workspace/empty/model/empty.ecore#/","eClass":"http://www.eclipse.org/emf/2002/Ecore#//EPackage"},"feature":"eClassifiers","dataValues":[[{"eClass":"http://www.eclipse.org/emf/2002/Ecore#//EClass","name":"NewEClass0"},{"eClass":"http://www.eclipse.org/emf/2002/Ecore#//EClass","name":"NewEClass1"}]]}

The exception doesn't always occur (but it's relatively frequent, ~70% of the time when I create a new class), and doesn't seem to "break" anything.

The exception was introduced with the Model Server update in PR #116 (Or maybe it was already there, but we didn't notice it because of the previous exception in #115)

eneufeld commented 2 years ago

@CamilleLetavernier is this fixed with the PR you linked or do we need some work on the modelserver to fix this?

CamilleLetavernier commented 2 years ago

I haven't fixed it, but I haven't investigated it either. I don't know if it's an issue with the Ecore GLSP integration or if it's related to the Model Server.