Repository navigation
Conversation
…tyAdapter Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Taking up #1226 as I said there: the adapter now makes the shared fields accessible once, so concurrent reads and writes no longer reset each other's access.
GsonVdmEntityAdapterkeepsjava.lang.reflect.Fieldobjects in a map that is shared by every thread using the sameGsoninstance. On each read and write it calledsetAccessible(true), used the field, and then restored the previous value withsetAccessible(false). Because theFieldobject is shared, one thread's restore can run between another thread'ssetAccessible(true)andField.get(), which fails intermittently withIllegalAccessException(logged as "Could not serialize property ... Returning null instead").This change calls
setAccessible(true)once, when the adapter builds its property map, and removes the per-call toggling inreadandgetEntityAsJsonObject. The fields are the private fields of generated VDM classes, which were already made accessible on every call, so no new access is opened.Added
GsonVdmEntityAdapterConcurrencyTest, which serializes and deserializes aPersonand asserts that the shared fields are still accessible afterwards. It checks the cause deterministically instead of relying on thread timing. Added a line torelease_notes.md.Tests run:
mvn -pl datamodel/odata-v4/odata-v4-core -am test -Dtest='GsonVdm*Test'passes; the wholecom.sap.cloud.sdk.datamodel.odatav4test set in that module passes (276 run, 0 failures, 12 skipped). With the fix reverted, the new test fails. I removed three explanatory code comments after that run to follow the project's no-comments guideline; the code is otherwise unchanged and was not re-run.Not verified: I did not run the 100-thread reproduction from the issue, and did not run other modules or the full build.
Definition of Done:
Error handling created / updated & covered by the tests aboveDocumentation updatedRefs #1226