eclipse-basyx / basyx-java-server-sdk

MIT License
60 stars 47 forks source link

[BUG] Submodel Service: The Call of GetSubmodelMeta Changes The InMemory Storage Object #459

Closed geso02 closed 4 weeks ago

geso02 commented 2 months ago

Describe the bug

When reading the metadata of the submodel-service submodel, the in-memory object is changed by setting the list of all submodel elements to null.

Subsequent calls then throw an exception. Besides, the object should not be changed during the reading operation. You would rather need to copy the data except for the submodel elements.

java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because "allSubmodels" is null

To Reproduce Steps to reproduce the behavior:

  1. Set up the submodel service
  2. GET /submodel/$metadata
  3. GET /submodel/submodel-elements =>Exception occurs: { "timestamp": 1726556325622, "status": 500, "error": "Internal Server Error", "path": "/submodel/submodel-elements" }

Expected behavior

We should rather copy the object - at least for the in-memory solution - but not alter the object on a GET-operation.

BaSyx (please complete the following information):

System (please complete the following information):

aaronzi commented 2 months ago

Hi @geso02,

thank you for reporting this! We will have a look and come up with a fix.