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

2.x: Fix concatMapDelayError not continuing on fused inner source crash #6522

Merged
merged 1 commit into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,13 @@ void drain() {
vr = supplier.call();
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
upstream.cancel();
errors.addThrowable(e);
downstream.onError(errors.terminate());
return;
if (!veryEnd) {
upstream.cancel();
downstream.onError(errors.terminate());
return;
}
vr = null;
}

if (vr == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

import static org.junit.Assert.assertEquals;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;

import org.junit.Test;
import org.reactivestreams.Publisher;

import io.reactivex.*;
import io.reactivex.exceptions.TestException;
import io.reactivex.exceptions.*;
import io.reactivex.functions.*;
import io.reactivex.internal.operators.flowable.FlowableConcatMap.WeakScalarSubscription;
import io.reactivex.schedulers.Schedulers;
Expand Down Expand Up @@ -168,4 +168,42 @@ public void run() throws Exception {

assertEquals(0, counter.get());
}

@Test
public void delayErrorCallableTillTheEnd() {
Flowable.just(1, 2, 3, 101, 102, 23, 890, 120, 32)
.concatMapDelayError(new Function<Integer, Flowable<Integer>>() {
@Override public Flowable<Integer> apply(final Integer integer) throws Exception {
return Flowable.fromCallable(new Callable<Integer>() {
@Override public Integer call() throws Exception {
if (integer >= 100) {
throw new NullPointerException("test null exp");
}
return integer;
}
});
}
})
.test()
.assertFailure(CompositeException.class, 1, 2, 3, 23, 32);
}

@Test
public void delayErrorCallableEager() {
Flowable.just(1, 2, 3, 101, 102, 23, 890, 120, 32)
.concatMapDelayError(new Function<Integer, Flowable<Integer>>() {
@Override public Flowable<Integer> apply(final Integer integer) throws Exception {
return Flowable.fromCallable(new Callable<Integer>() {
@Override public Integer call() throws Exception {
if (integer >= 100) {
throw new NullPointerException("test null exp");
}
return integer;
}
});
}
}, 2, false)
.test()
.assertFailure(NullPointerException.class, 1, 2, 3);
}
}