Skip to content

Issue in XmlSerializer when serializing the empty statements #390

@mdanish98

Description

@mdanish98

There is an issue in XmlSerializer, it is not able to set the Empty list of statements inside Operation -> inputVariables -> operationVariable -> value -> Entity.

It still serializes the empty statement. The implementation is already with a comment that specifically mentions statements, maybe it needs to do it in a recursive manner.

The exact location of this implementation is here.

Below is the test to reproduce this issue:

public void serializeOperation() throws SerializationException, SAXException {

        Operation operation = new DefaultOperation.Builder().idShort("dummyOperation").inputVariables(new DefaultOperationVariable.Builder().value(
                new DefaultEntity.Builder().idShort("dummyEntity").build()).build()).build();

        Submodel submodel = new DefaultSubmodel.Builder().id("dummySubmodel").idShort("dummySubmodel")
                .submodelElements(operation).build();

        String xml = new XmlSerializer().write(new DefaultEnvironment.Builder().submodels(submodel).build());
}

Note: We checked just the above scenario, maybe the root cause is different or there could be another scenarios where this issue is reproducible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions