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

Flux#next throws NoSuchElementException on a non-finite empty iterator #3307

Closed
jzheaux opened this issue Dec 2, 2022 · 0 comments
Closed
Labels
warn/regression A regression from a previous release
Milestone

Comments

@jzheaux
Copy link

jzheaux commented Dec 2, 2022

Spring Security's R2dbcReactiveOAuth2AuthorizedClientServiceTests started failing on the 3.5.1-SNAPSHOT recently.

It appears to coincide with the changes in this commit (67cc87a).

Here is a quick test that fails that is a minimal representation of what the Spring Security tests are doing:

@Test
public void testFluxIterable() {
    Iterable<String> iterable = mock(Iterable.class);
    given(iterable.spliterator()).willReturn(mock(Spliterator.class));
    Flux.fromIterable(iterable).next().block();
}

The Javadoc for Flux#next says

Emit only the first item emitted by this Flux, into a new Mono. If called on an empty Flux, emits an empty Mono.

I would expect the above test to pass, but it instead throws a NoSuchElementException.

@reactorbot reactorbot added the ❓need-triage This issue needs triage, hasn't been looked at by a team member yet label Dec 2, 2022
@OlegDokuka OlegDokuka added warn/regression A regression from a previous release and removed ❓need-triage This issue needs triage, hasn't been looked at by a team member yet labels Dec 2, 2022
@OlegDokuka OlegDokuka added this to the 3.4.26 milestone Dec 2, 2022
OlegDokuka added a commit that referenced this issue Dec 8, 2022
Signed-off-by: Oleh Dokuka <odokuka@vmware.com>
OlegDokuka added a commit that referenced this issue Dec 12, 2022
Signed-off-by: OlegDokuka <odokuka@vmware.com>
OlegDokuka added a commit that referenced this issue Jan 11, 2023
…llowup)

Signed-off-by: Oleh Dokuka <odokuka@vmware.com>
chemicL pushed a commit that referenced this issue Mar 7, 2023
closes #3307

also, this commit does minor dependencies and unused constructors cleaning as well as increase tests coverage to cover more corner cases related to unknown empty iterable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
warn/regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

3 participants