Skip to content

Log the class name of mapper in operators if the return value of mapper.apply(t) is null #2982

@JamesChenX

Description

@JamesChenX

Motivation

The mapper returned a null value. isn't helpful to pinpoint which mapper returns a null value. e.g.: Objects.requireNonNull(this.mapper.apply(t), "The mapper returned a null value.") in FluxMap.
And it's will be helpful if the class name of mapper is also logged.

Desired solution

Object value = this.mapper.apply(t);
if (value == null) {
    throw new NullPointerException("The mapper ["+ mapper.getClass().getName() + "] returned a null value.");
}

Considered alternatives

Additional context

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions