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

Defensively create collections in JAXB getters #137

Closed
evdherberg opened this issue Jul 26, 2022 · 2 comments
Closed

Defensively create collections in JAXB getters #137

evdherberg opened this issue Jul 26, 2022 · 2 comments
Assignees

Comments

@evdherberg
Copy link
Contributor

The POST /restapi/v1/chatrooms encounters NPE's whenever one of the optional List elements is included in the payload. Here it is suggested that JAXB does not use collection setters, so the collection getter should always return a non-null value. And, indeed, when I change the getter implementation to defensively create the list, the NPE disappears.

What puzzles me is that this must have occurred before, when the create room functionality was initially developed. So either this resource was added with virtually no testing, or something changed since then (JAXB versions?), or there is something very local to my development environment that causes this problem. Anyway, I thought best to raise this issue, and I will prepare a PR for the defensive creation of collections in the MUCRoomEntity.

@evdherberg evdherberg self-assigned this Jul 26, 2022
evdherberg added a commit to evdherberg/openfire-restAPI-plugin that referenced this issue Jul 29, 2022
guusdk added a commit to evdherberg/openfire-restAPI-plugin that referenced this issue Jul 31, 2022
guusdk pushed a commit to evdherberg/openfire-restAPI-plugin that referenced this issue Jul 31, 2022
guusdk added a commit to evdherberg/openfire-restAPI-plugin that referenced this issue Jul 31, 2022
guusdk pushed a commit to evdherberg/openfire-restAPI-plugin that referenced this issue Jul 31, 2022
guusdk added a commit to evdherberg/openfire-restAPI-plugin that referenced this issue Jul 31, 2022
guusdk added a commit to evdherberg/openfire-restAPI-plugin that referenced this issue Jul 31, 2022
@guusdk
Copy link
Member

guusdk commented Jul 31, 2022

I wonder if the issue that you're trying to fix here is #15 in disguise. Let's see if #131 fixes the issue that you are running into. If that is the case, then we probably do not need further changes.

@evdherberg
Copy link
Contributor Author

I wonder if the issue that you're trying to fix here is #15 in disguise. Let's see if #131 fixes the issue that you are running into. If that is the case, then we probably do not need further changes.

That is indeed the case. In my last tests, without my changes to the entity, the problem was not there anymore. So probably #131 was the same problem. I am closing this issue and I will close the PR too.

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 a pull request may close this issue.

2 participants