Skip to content

Defensively create collections in JAXB getters #137

@evdherberg

Description

@evdherberg

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions