Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssetAdministrationShellEnvironmentSerializer sets empty lists to null during XML serialization and breaks serialized Environment #59

Closed
andreas-schilling opened this issue Feb 15, 2023 · 2 comments · Fixed by #157
Assignees
Labels
3.0 Final AAS V3 Final Release bug Something isn't working V.1.0.0 Final Release V.1.0.0 following EF processes

Comments

@andreas-schilling
Copy link
Contributor

The AssetAdministrationShellEnvironmentSerializer has an side effect on the Environment that is being serialized and thus it is broken afterwards.
It's not possible to serialize it a second time, e.g. to write both XML and AASX files.

The problematic part of the code is the following (line 125ff):

private void writeWrappedArray(ToXmlGenerator xgen, QName wrapper, QName wrapped, List<?> list)
            throws IOException {
        // overwrite all empty list with null, as the schema does not allow empty XML lists
        for (Object obj : list) ReflectionHelper.setEmptyListsToNull(obj);

The comment explains the measure, however the serializer should handle this issue differently. If this is not possible it probably would be best to keep track of which fields have been replaced with null and revert the change afterwards.

@FrankSchnicke
Copy link
Contributor

Thank you very much for pointing out this issue. We will tackle this after the Hannover Fair.

@FrankSchnicke
Copy link
Contributor

A sensible fix requires most likely copy constructors, thus this ticket is dependent on #85

@twebermartins twebermartins added 3.0 Final AAS V3 Final Release V.1.0.0 Final Release V.1.0.0 following EF processes labels Jun 5, 2023
@twebermartins twebermartins moved this from 🆕 New to 📋 Backlog in Eclipse AAS4J Dev Aug 1, 2023
@FrankSchnicke FrankSchnicke moved this from 📋 Backlog to 👀 In review in Eclipse AAS4J Dev Aug 9, 2023
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Eclipse AAS4J Dev Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0 Final AAS V3 Final Release bug Something isn't working V.1.0.0 Final Release V.1.0.0 following EF processes
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants