use lazy initialization to resolve circular dependency between the DataFieldSerializer, DataTypeSerializer, and RowTypeSerializer classes that causes NPE for certain RowTypes like nested row type#3400
Open
umeshdangat wants to merge 2 commits into
Conversation
…ataFieldSerializer`, `DataTypeSerializer`, and `RowTypeSerializer` classes that causes NPE for certain RowTypes like nested row type
|
This pull request has been automatically marked as stale because it has not had recent activity for 60 days. It will be closed in 30 days if no further activity occurs. |
|
This pull request has been automatically marked as stale because it has not had recent activity for 60 days. It will be closed in 30 days if no further activity occurs. |
|
This pull request has been closed because it has not had recent activity. You could reopen it if you try to continue your work, and anyone who are interested in it are encouraged to continue work on this pull request. |
Member
|
Could @leonardBang please reopen this? |
Contributor
Author
|
PR #3434 also has this change! Merging that should enable us to close this. |
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.
There is a circular dependency between the
DataFieldSerializer,DataTypeSerializer, andRowTypeSerializerclasses. This circular dependency can lead to incomplete initialization of the serializers, causing aNullPointerExceptionwhen you attempt to use them.Here's a breakdown of the problem:
DataFieldSerializerhas aDataTypeSerializerinstance.DataTypeSerializerhas aRowTypeSerializerinstance.RowTypeSerializerhas aListSerializer<DataField>instance, which in turn usesDataFieldSerializer.This circular dependency can cause the serializers to be in an incomplete state when they are first accessed, leading to the
NullPointerException.Code below is enough to re-create this NPE