Skip to content

Don't allow null CloudEventDataMapper #285

@eamonnmcmanus

Description

@eamonnmcmanus

I was starting to log an issue about a NullPointerException in Milestone 4 when I discovered that @matejvasek had already fixed it in #259. I'd like to suggest that other similar NPEs could be avoided if we didn't allow the mapper in MessageReader.toEvent(CloudEventDataMapper) to be null. There's no reason to allow that, and it's just setting a trap. If you don't need to map the data then just supply an identity mapper. The no-arg MessageReader.toEvent() could call toEvent(data -> data) instead of toEvent(null). And a bunch of if (mapper == null) code could presumably be removed.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions