eclipse-emfcloud / emfcloud-modelserver

Modelserver component
Other
43 stars 21 forks source link

Transaction websocket context does not provide model URI #248

Closed cdamus closed 2 years ago

cdamus commented 2 years ago

Now that we have CodecProviders that can provide different codecs according to model URI, we depend heavily on getting the model URI from the request/socket context in order to look up the codec used to decode request or message payloads.

This works for the API endpoint requests and for the subscription websocket, but not for the websocket that implements a compound edit transaction. The websocket context in this case cannot provide the model URI as required by, for example, the EMFCommandHandler::getPatchCommand(WsContext, JsonNode) method. The consequence is that attempting to find the codec to decode a command executed within a transaction throws an NPE on attempting to interrogate the null model URI in an application-specific CodecProvider or, at least, if the provider is resilient to nulls then the correct application-specific codec won't be found and decoding the message will fail.

However, the DefaultModelURIConverter::resolveModelURI(WsContext) method could be updated to look in the TransactionController to map the context to a transaction's model URI in the case that the normal way to retrieve the model URI from the context fails.