Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related issue: #4852 Motivation: `FuseableStreamMessage.collect()` throws a `NPE` when only `mapError()` is applied to a normal `StreamMessage`. ```java StreamMessage.of(1, 2, 3, 4) .mapError(IllegalStateException::new) // Raises a NullPointerException .collect().join(); ``` The `function` field in `FuseableStreamMessage` can be null if no `map()` is applied to `FuseableStreamMessage`. https://github.com/line/armeria/blob/871d87297e4d051241589cb1ae95641cbc83f880/core/src/main/java/com/linecorp/armeria/common/stream/FuseableStreamMessage.java#L162 The problem only happens when `collect()` method is called. `subscribe()` method already takes the case into account. Modifications: - Use the original object as is if `function` is null. Result: - You no longer see `NullPointerException` when `.mapError()` is applied to `StreamMessage` - Closes #4852
- Loading branch information