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

[Bugfix] Files in SubmodelElementLists and NullPointerException when serializing/deserializing empty files #250

Merged
merged 10 commits into from
Feb 27, 2024

Conversation

fvolz
Copy link
Contributor

@fvolz fvolz commented Feb 15, 2024

When a File had an empty value, a NullpointerException would occur in both AASXDeserializer and AASXSerializer. This is now filtered out with file.getValue != null
Additionally, Files in SubmodelElementLists were not included in the fileList. This was fixed by using the Visitor to get all files.

@FrankSchnicke
Copy link
Contributor

Thanks a lot for providing this bugfix. Would it be possible to provide a test case illustrating that the issue has been fixed?

@FrankSchnicke
Copy link
Contributor

If I understand it correctly, the empty files issue is in the AASXSerializer. Would it be possible to move this test case to the TestAASXSerializer? Additionally, the test does not test the issue correctly. After reverting the code in AASX(De)Serializer, emptyFiles still passes.

@fvolz
Copy link
Contributor Author

fvolz commented Feb 23, 2024

If I understand it correctly, the empty files issue is in the AASXSerializer. Would it be possible to move this test case to the TestAASXSerializer? Additionally, the test does not test the issue correctly. After reverting the code in AASX(De)Serializer, emptyFiles still passes.

I fixed the null test to test the issue. The null issue occured for me in the Deserializer, however, the Deserializer tests utilize the Serializer. When I add an empty file in the SerializerTest, no issue occurs.

EDIT: I changed the serializer test to AASFull which leads to java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "path" in the reverted code.
EDIT2: AASFull had 2 files with the same value and no thumbnail leading to assert failures
EDIT3: I could not make changes to AASFull because other tests expect the exact structure. So instead of adding thumbnail to AASFull, I changed the AASXSerializerTest to both test AASSimple with thumbnail and AASFull without thumbnail

Copy link
Contributor

@FrankSchnicke FrankSchnicke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some unused imports now in AASXDeserializer, AASXSerializer & AASXSerializerTest that lead to warnings. Would it be possible to remove them? I will gladly merge after the warnings are removed and the other comment is addressed.

@FrankSchnicke FrankSchnicke merged commit 6c2b04e into eclipse-aas4j:main Feb 27, 2024
2 checks passed
@FrankSchnicke
Copy link
Contributor

Thanks a lot!

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

Successfully merging this pull request may close these issues.

2 participants