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

Add JsonIgnore to a few fields in configuration objects #1260

Merged
merged 1 commit into from
Feb 21, 2018

Conversation

sijie
Copy link
Member

@sijie sijie commented Feb 20, 2018

Problem

We have seen NPE thrown when ConsumerStats tries to dump the configuration object with a customized ConsumerEventsListener.
The problem came from initialization sequence and when jackson tried to serialize the customized ConsumerEventsListener,
it fails with NPE.

In general, those customized implementation such as MessageRouter, MessageListener and ConsumerEventsListener are not
really needed to serialize as part of json.

Solution

Add @JsonIgnore to those fields to bypass json serialization

*Problem*

We have seen NPE thrown when `ConsumerStats` tries to dump the configuration object with a customized ConsumerEventsListener.
The problem came from initialization sequence and when jackson tried to serialize the customized ConsumerEventsListener,
it fails with NPE.

In general, those customized implementation such as `MessageRouter`, `MessageListener` and `ConsumerEventsListener` are not
really needed to serialize as part of json.

*Solution*

Add @JsonIgnore to those fields to bypass json serialization
@sijie sijie self-assigned this Feb 20, 2018
@sijie
Copy link
Member Author

sijie commented Feb 20, 2018

Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

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

👍

@merlimat merlimat merged commit 8d9f277 into apache:master Feb 21, 2018
@merlimat merlimat added this to the 2.0.0-incubating milestone Feb 21, 2018
sijie added a commit to sijie/pulsar that referenced this pull request Mar 4, 2018

*Problem*

If we assign workerConfig after setting consumer listener, when `ConsumerStats` tries to dump the consumer configuration,
it will throw NPE.

*Solution*

apache#1260 tried to ignore listener fields for json serialization

this change focus on avoiding NPE on serializing MembershipManager
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