Skip to content
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 @@ -519,10 +519,13 @@ void drain() {
vr = supplier.get();
} 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);
}
}