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

Throw sensible exception in case of deserialization error or output warning #174

Open
msiebert-dev opened this issue Sep 19, 2023 · 3 comments

Comments

@msiebert-dev
Copy link

msiebert-dev commented Sep 19, 2023

When creating a v3.0 aasx file with Package Explorer the output xml may contain self closing tags as is the case in the following snippet:
<semanticId> <type>ExternalReference</type> <keys /> </semanticId>

The empty <keys /> tag leads to deserialization failure in the XMLDeserialzer read method.
The same applies for self closing <outputVariables/> , <inoutputVariables /> or <multiLanguageProperty><value /></multiLanguageProperty> tags.
A check for null may be sufficient as in the EmbeddedDataSpecificationsDeserializer deserialize method. A self cosing <embeddedDataSpecifications /> tag doesn't lead to deserialization failure.

If the self closing <!-- keys /--> tag is commented out the deserialization doesn't fail, although the reference is invalid according to the specification because it doesn't contain any <key>.

A sensible exception or a warning would be helpful.

Attached is a v2.0 zip file which after renaming to .aasx and saving in Package Explorer lead to a deserialization failure when read with AASXDeserializer.java.
DrillerInstance - Instance.zip

@msiebert-dev
Copy link
Author

msiebert-dev commented Sep 19, 2023

If the <!-- keys /--> tag is commented out the deserialization doesn't fail any more. According to the specification however a reference without a <key> is not valid.

@FrankSchnicke
Copy link
Contributor

Please see #172.
To summarize, this is an issue with the AASX Package Explorer not creating spec conforming AASX files. Feel free to create an issue in the AASX Package Explorer repository.

@alexgordtop
Copy link
Contributor

alexgordtop commented Sep 19, 2023

@FrankSchnicke You are right and we already did this:
https://github.com/admin-shell-io/temp-aasx-package-explorer/issues/97

But shouldn't the import / reader race at least a warning, that there are invalid SemanticIds included in the imported aasx?
As @msiebert-dev wrote, if keys are not present, then the importer would import an invalid reference...
...only with type, but without keys.

Or should we afterwards execute an explicit validation?

@msiebert-dev msiebert-dev changed the title Deserialization fails if aasx XML contains empty <keys /> Throw sensible exception in case of deserialization error or output warning Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants