The following issues were found
src/test/java/io/reactivex/rxjava3/internal/functions/ObjectHelperTest.java
10 issues
Line: 26
public class ObjectHelperTest extends RxJavaTest {
@Test
public void utilityClass() {
TestHelper.checkUtilityClass(ObjectHelper.class);
}
@Test
public void verifyPositiveInt() throws Exception {
Reported by PMD.
Line: 31
}
@Test
public void verifyPositiveInt() throws Exception {
assertEquals(1, ObjectHelper.verifyPositive(1, "param"));
}
@Test
public void verifyPositiveLong() throws Exception {
Reported by PMD.
Line: 32
@Test
public void verifyPositiveInt() throws Exception {
assertEquals(1, ObjectHelper.verifyPositive(1, "param"));
}
@Test
public void verifyPositiveLong() throws Exception {
assertEquals(1L, ObjectHelper.verifyPositive(1L, "param"));
Reported by PMD.
Line: 32
@Test
public void verifyPositiveInt() throws Exception {
assertEquals(1, ObjectHelper.verifyPositive(1, "param"));
}
@Test
public void verifyPositiveLong() throws Exception {
assertEquals(1L, ObjectHelper.verifyPositive(1L, "param"));
Reported by PMD.
Line: 36
}
@Test
public void verifyPositiveLong() throws Exception {
assertEquals(1L, ObjectHelper.verifyPositive(1L, "param"));
}
@Test(expected = IllegalArgumentException.class)
public void verifyPositiveIntFail() throws Exception {
Reported by PMD.
Line: 37
@Test
public void verifyPositiveLong() throws Exception {
assertEquals(1L, ObjectHelper.verifyPositive(1L, "param"));
}
@Test(expected = IllegalArgumentException.class)
public void verifyPositiveIntFail() throws Exception {
assertEquals(-1, ObjectHelper.verifyPositive(-1, "param"));
Reported by PMD.
Line: 41
}
@Test(expected = IllegalArgumentException.class)
public void verifyPositiveIntFail() throws Exception {
assertEquals(-1, ObjectHelper.verifyPositive(-1, "param"));
}
@Test(expected = IllegalArgumentException.class)
public void verifyPositiveLongFail() throws Exception {
Reported by PMD.
Line: 42
@Test(expected = IllegalArgumentException.class)
public void verifyPositiveIntFail() throws Exception {
assertEquals(-1, ObjectHelper.verifyPositive(-1, "param"));
}
@Test(expected = IllegalArgumentException.class)
public void verifyPositiveLongFail() throws Exception {
assertEquals(-1L, ObjectHelper.verifyPositive(-1L, "param"));
Reported by PMD.
Line: 46
}
@Test(expected = IllegalArgumentException.class)
public void verifyPositiveLongFail() throws Exception {
assertEquals(-1L, ObjectHelper.verifyPositive(-1L, "param"));
}
}
Reported by PMD.
Line: 47
@Test(expected = IllegalArgumentException.class)
public void verifyPositiveLongFail() throws Exception {
assertEquals(-1L, ObjectHelper.verifyPositive(-1L, "param"));
}
}
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableInternalHelperTest.java
10 issues
Line: 26
public class ObservableInternalHelperTest extends RxJavaTest {
@Test
public void utilityClass() {
TestHelper.checkUtilityClass(ObservableInternalHelper.class);
}
@Test
public void enums() {
Reported by PMD.
Line: 31
}
@Test
public void enums() {
assertNotNull(ObservableInternalHelper.MapToInt.values()[0]);
assertNotNull(ObservableInternalHelper.MapToInt.valueOf("INSTANCE"));
}
Reported by PMD.
Line: 32
@Test
public void enums() {
assertNotNull(ObservableInternalHelper.MapToInt.values()[0]);
assertNotNull(ObservableInternalHelper.MapToInt.valueOf("INSTANCE"));
}
@Test
Reported by PMD.
Line: 32
@Test
public void enums() {
assertNotNull(ObservableInternalHelper.MapToInt.values()[0]);
assertNotNull(ObservableInternalHelper.MapToInt.valueOf("INSTANCE"));
}
@Test
Reported by PMD.
Line: 33
@Test
public void enums() {
assertNotNull(ObservableInternalHelper.MapToInt.values()[0]);
assertNotNull(ObservableInternalHelper.MapToInt.valueOf("INSTANCE"));
}
@Test
public void mapToInt() throws Exception {
Reported by PMD.
Line: 33
@Test
public void enums() {
assertNotNull(ObservableInternalHelper.MapToInt.values()[0]);
assertNotNull(ObservableInternalHelper.MapToInt.valueOf("INSTANCE"));
}
@Test
public void mapToInt() throws Exception {
Reported by PMD.
Line: 38
}
@Test
public void mapToInt() throws Exception {
assertEquals(0, ObservableInternalHelper.MapToInt.INSTANCE.apply(null));
}
}
Reported by PMD.
Line: 39
@Test
public void mapToInt() throws Exception {
assertEquals(0, ObservableInternalHelper.MapToInt.INSTANCE.apply(null));
}
}
Reported by PMD.
Line: 39
@Test
public void mapToInt() throws Exception {
assertEquals(0, ObservableInternalHelper.MapToInt.INSTANCE.apply(null));
}
}
Reported by PMD.
Line: 16
package io.reactivex.rxjava3.internal.operators.observable;
import static org.junit.Assert.*;
import org.junit.Test;
import io.reactivex.rxjava3.core.RxJavaTest;
import io.reactivex.rxjava3.testsupport.TestHelper;
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableSafeSubscribeTest.java
10 issues
Line: 34
public class CompletableSafeSubscribeTest {
@Test
public void normalError() throws Throwable {
TestHelper.withErrorTracking(errors -> {
CompletableObserver consumer = mock(CompletableObserver.class);
Completable.error(new TestException())
.safeSubscribe(consumer);
Reported by PMD.
Line: 46
order.verify(consumer).onError(any(TestException.class));
order.verifyNoMoreInteractions();
assertTrue("" + errors, errors.isEmpty());
});
}
@Test
public void normalEmpty() throws Throwable {
Reported by PMD.
Line: 51
}
@Test
public void normalEmpty() throws Throwable {
TestHelper.withErrorTracking(errors -> {
CompletableObserver consumer = mock(CompletableObserver.class);
Completable.complete()
.safeSubscribe(consumer);
Reported by PMD.
Line: 66
}
@Test
public void onSubscribeCrash() throws Throwable {
TestHelper.withErrorTracking(errors -> {
CompletableObserver consumer = mock(CompletableObserver.class);
doThrow(new TestException()).when(consumer).onSubscribe(any());
Disposable d = Disposable.empty();
Reported by PMD.
Line: 88
order.verify(consumer).onSubscribe(any(Disposable.class));
order.verifyNoMoreInteractions();
assertTrue(d.isDisposed());
TestHelper.assertUndeliverable(errors, 0, TestException.class);
TestHelper.assertUndeliverable(errors, 1, IOException.class);
});
}
Reported by PMD.
Line: 96
}
@Test
public void onErrorCrash() throws Throwable {
TestHelper.withErrorTracking(errors -> {
CompletableObserver consumer = mock(CompletableObserver.class);
doThrow(new TestException()).when(consumer).onError(any());
new Completable() {
Reported by PMD.
Line: 125
}
@Test
public void onCompleteCrash() throws Throwable {
TestHelper.withErrorTracking(errors -> {
CompletableObserver consumer = mock(CompletableObserver.class);
doThrow(new TestException()).when(consumer).onComplete();
new Completable() {
Reported by PMD.
Line: 18
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
import java.io.IOException;
import org.junit.Test;
import org.mockito.InOrder;
Reported by PMD.
Line: 26
import org.mockito.InOrder;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class CompletableSafeSubscribeTest {
Reported by PMD.
Line: 28
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class CompletableSafeSubscribeTest {
@Test
Reported by PMD.
src/main/java/io/reactivex/rxjava3/subscribers/SerializedSubscriber.java
10 issues
Line: 37
* @param <T> the value type
*/
public final class SerializedSubscriber<T> implements FlowableSubscriber<T>, Subscription {
final Subscriber<? super T> downstream;
final boolean delayError;
static final int QUEUE_LINK_SIZE = 4;
Subscription upstream;
Reported by PMD.
Line: 38
*/
public final class SerializedSubscriber<T> implements FlowableSubscriber<T>, Subscription {
final Subscriber<? super T> downstream;
final boolean delayError;
static final int QUEUE_LINK_SIZE = 4;
Subscription upstream;
Reported by PMD.
Line: 42
static final int QUEUE_LINK_SIZE = 4;
Subscription upstream;
boolean emitting;
AppendOnlyLinkedArrayList<Object> queue;
volatile boolean done;
Reported by PMD.
Line: 44
Subscription upstream;
boolean emitting;
AppendOnlyLinkedArrayList<Object> queue;
volatile boolean done;
/**
Reported by PMD.
Line: 45
Subscription upstream;
boolean emitting;
AppendOnlyLinkedArrayList<Object> queue;
volatile boolean done;
/**
* Construct a {@code SerializedSubscriber} by wrapping the given actual {@link Subscriber}.
Reported by PMD.
Line: 47
boolean emitting;
AppendOnlyLinkedArrayList<Object> queue;
volatile boolean done;
/**
* Construct a {@code SerializedSubscriber} by wrapping the given actual {@link Subscriber}.
* @param downstream the actual {@code Subscriber}, not null (not verified)
*/
Reported by PMD.
Line: 184
emitting = false;
return;
}
queue = null;
}
if (q.accept(downstream)) {
return;
}
Reported by PMD.
Line: 187
queue = null;
}
if (q.accept(downstream)) {
return;
}
}
}
Reported by PMD.
Line: 16
package io.reactivex.rxjava3.subscribers;
import org.reactivestreams.*;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.FlowableSubscriber;
import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper;
import io.reactivex.rxjava3.internal.util.*;
Reported by PMD.
Line: 21
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.FlowableSubscriber;
import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper;
import io.reactivex.rxjava3.internal.util.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
/**
* Serializes access to the {@link Subscriber#onNext(Object)}, {@link Subscriber#onError(Throwable)} and
* {@link Subscriber#onComplete()} methods of another {@link Subscriber}.
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoOnTerminateTest.java
10 issues
Line: 43
.test()
.assertResult(1);
assertTrue(atomicBoolean.get());
}
@Test
public void doOnTerminateError() {
final AtomicBoolean atomicBoolean = new AtomicBoolean();
Reported by PMD.
Line: 58
.test()
.assertFailure(TestException.class);
assertTrue(atomicBoolean.get());
}
@Test
public void doOnTerminateSuccessCrash() {
Single.just(1).doOnTerminate(new Action() {
Reported by PMD.
Line: 62
}
@Test
public void doOnTerminateSuccessCrash() {
Single.just(1).doOnTerminate(new Action() {
@Override
public void run() throws Exception {
throw new TestException();
}
Reported by PMD.
Line: 74
}
@Test
public void doOnTerminateErrorCrash() {
TestObserverEx<Object> to = Single.error(new TestException("Outer")).doOnTerminate(new Action() {
@Override
public void run() {
throw new TestException("Inner");
}
Reported by PMD.
Line: 84
.to(TestHelper.testConsumer())
.assertFailure(CompositeException.class);
List<Throwable> errors = TestHelper.compositeList(to.errors().get(0));
TestHelper.assertError(errors, 0, TestException.class, "Outer");
TestHelper.assertError(errors, 1, TestException.class, "Inner");
}
}
Reported by PMD.
Line: 23
import org.junit.Test;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.testsupport.*;
public class SingleDoOnTerminateTest extends RxJavaTest {
Reported by PMD.
Line: 24
import org.junit.Test;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.testsupport.*;
public class SingleDoOnTerminateTest extends RxJavaTest {
Reported by PMD.
Line: 26
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.testsupport.*;
public class SingleDoOnTerminateTest extends RxJavaTest {
@Test
public void doOnTerminateSuccess() {
Reported by PMD.
Line: 75
@Test
public void doOnTerminateErrorCrash() {
TestObserverEx<Object> to = Single.error(new TestException("Outer")).doOnTerminate(new Action() {
@Override
public void run() {
throw new TestException("Inner");
}
})
Reported by PMD.
Line: 75
@Test
public void doOnTerminateErrorCrash() {
TestObserverEx<Object> to = Single.error(new TestException("Outer")).doOnTerminate(new Action() {
@Override
public void run() {
throw new TestException("Inner");
}
})
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnEventTest.java
10 issues
Line: 33
public class MaybeDoOnEventTest extends RxJavaTest {
@Test
public void dispose() {
TestHelper.checkDisposed(PublishSubject.<Integer>create().singleElement().doOnEvent(new BiConsumer<Integer, Throwable>() {
@Override
public void accept(Integer v, Throwable e) throws Exception {
// irrelevant
}
Reported by PMD.
Line: 43
}
@Test
public void doubleOnSubscribe() {
TestHelper.checkDoubleOnSubscribeMaybe(new Function<Maybe<Integer>, MaybeSource<Integer>>() {
@Override
public MaybeSource<Integer> apply(Maybe<Integer> m) throws Exception {
return m.doOnEvent(new BiConsumer<Integer, Throwable>() {
@Override
Reported by PMD.
Line: 81
.to(TestHelper.<Integer>testConsumer())
.assertFailureAndMessage(TestException.class, "First");
assertTrue(bs.isDisposed());
TestHelper.assertUndeliverable(errors, 0, TestException.class, "Second");
} finally {
RxJavaPlugins.reset();
}
Reported by PMD.
Line: 81
.to(TestHelper.<Integer>testConsumer())
.assertFailureAndMessage(TestException.class, "First");
assertTrue(bs.isDisposed());
TestHelper.assertUndeliverable(errors, 0, TestException.class, "Second");
} finally {
RxJavaPlugins.reset();
}
Reported by PMD.
Line: 22
import org.junit.Test;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.subjects.PublishSubject;
Reported by PMD.
Line: 23
import org.junit.Test;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.TestHelper;
Reported by PMD.
Line: 25
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class MaybeDoOnEventTest extends RxJavaTest {
Reported by PMD.
Line: 59
@Test
public void onSubscribeCrash() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final Disposable bs = Disposable.empty();
new Maybe<Integer>() {
@Override
Reported by PMD.
Line: 59
@Test
public void onSubscribeCrash() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final Disposable bs = Disposable.empty();
new Maybe<Integer>() {
@Override
Reported by PMD.
Line: 59
@Test
public void onSubscribeCrash() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final Disposable bs = Disposable.empty();
new Maybe<Integer>() {
@Override
Reported by PMD.
src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWhen.java
10 issues
Line: 29
import java.util.Objects;
public final class FlowableRetryWhen<T> extends AbstractFlowableWithUpstream<T, T> {
final Function<? super Flowable<Throwable>, ? extends Publisher<?>> handler;
public FlowableRetryWhen(Flowable<T> source,
Function<? super Flowable<Throwable>, ? extends Publisher<?>> handler) {
super(source);
this.handler = handler;
Reported by PMD.
Line: 41
public void subscribeActual(Subscriber<? super T> s) {
SerializedSubscriber<T> z = new SerializedSubscriber<>(s);
FlowableProcessor<Throwable> processor = UnicastProcessor.<Throwable>create(8).toSerialized();
Publisher<?> when;
try {
when = Objects.requireNonNull(handler.apply(processor), "handler returned a null Publisher");
Reported by PMD.
Line: 41
public void subscribeActual(Subscriber<? super T> s) {
SerializedSubscriber<T> z = new SerializedSubscriber<>(s);
FlowableProcessor<Throwable> processor = UnicastProcessor.<Throwable>create(8).toSerialized();
Publisher<?> when;
try {
when = Objects.requireNonNull(handler.apply(processor), "handler returned a null Publisher");
Reported by PMD.
Line: 47
try {
when = Objects.requireNonNull(handler.apply(processor), "handler returned a null Publisher");
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
EmptySubscription.error(ex, s);
return;
}
Reported by PMD.
Line: 61
s.onSubscribe(subscriber);
when.subscribe(receiver);
receiver.onNext(0);
}
static final class RetryWhenSubscriber<T> extends WhenSourceSubscriber<T, Throwable> {
Reported by PMD.
Line: 16
package io.reactivex.rxjava3.internal.operators.flowable;
import org.reactivestreams.*;
import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.operators.flowable.FlowableRepeatWhen.*;
Reported by PMD.
Line: 21
import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.operators.flowable.FlowableRepeatWhen.*;
import io.reactivex.rxjava3.internal.subscriptions.EmptySubscription;
import io.reactivex.rxjava3.processors.*;
import io.reactivex.rxjava3.subscribers.SerializedSubscriber;
import java.util.Objects;
Reported by PMD.
Line: 23
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.operators.flowable.FlowableRepeatWhen.*;
import io.reactivex.rxjava3.internal.subscriptions.EmptySubscription;
import io.reactivex.rxjava3.processors.*;
import io.reactivex.rxjava3.subscribers.SerializedSubscriber;
import java.util.Objects;
public final class FlowableRetryWhen<T> extends AbstractFlowableWithUpstream<T, T> {
Reported by PMD.
Line: 39
@Override
public void subscribeActual(Subscriber<? super T> s) {
SerializedSubscriber<T> z = new SerializedSubscriber<>(s);
FlowableProcessor<Throwable> processor = UnicastProcessor.<Throwable>create(8).toSerialized();
Publisher<?> when;
Reported by PMD.
Line: 46
Publisher<?> when;
try {
when = Objects.requireNonNull(handler.apply(processor), "handler returned a null Publisher");
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
EmptySubscription.error(ex, s);
return;
}
Reported by PMD.
src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSampleWithObservable.java
10 issues
Line: 25
public final class ObservableSampleWithObservable<T> extends AbstractObservableWithUpstream<T, T> {
final ObservableSource<?> other;
final boolean emitLast;
public ObservableSampleWithObservable(ObservableSource<T> source, ObservableSource<?> other, boolean emitLast) {
super(source);
Reported by PMD.
Line: 27
final ObservableSource<?> other;
final boolean emitLast;
public ObservableSampleWithObservable(ObservableSource<T> source, ObservableSource<?> other, boolean emitLast) {
super(source);
this.other = other;
this.emitLast = emitLast;
Reported by PMD.
Line: 50
private static final long serialVersionUID = -3517602651313910099L;
final Observer<? super T> downstream;
final ObservableSource<?> sampler;
final AtomicReference<Disposable> other = new AtomicReference<>();
Disposable upstream;
Reported by PMD.
Line: 51
private static final long serialVersionUID = -3517602651313910099L;
final Observer<? super T> downstream;
final ObservableSource<?> sampler;
final AtomicReference<Disposable> other = new AtomicReference<>();
Disposable upstream;
Reported by PMD.
Line: 53
final Observer<? super T> downstream;
final ObservableSource<?> sampler;
final AtomicReference<Disposable> other = new AtomicReference<>();
Disposable upstream;
SampleMainObserver(Observer<? super T> actual, ObservableSource<?> other) {
this.downstream = actual;
Reported by PMD.
Line: 55
final AtomicReference<Disposable> other = new AtomicReference<>();
Disposable upstream;
SampleMainObserver(Observer<? super T> actual, ObservableSource<?> other) {
this.downstream = actual;
this.sampler = other;
}
Reported by PMD.
Line: 128
}
static final class SamplerObserver<T> implements Observer<Object> {
final SampleMainObserver<T> parent;
SamplerObserver(SampleMainObserver<T> parent) {
this.parent = parent;
}
Reported by PMD.
Line: 178
private static final long serialVersionUID = -3029755663834015785L;
final AtomicInteger wip;
volatile boolean done;
SampleMainEmitLast(Observer<? super T> actual, ObservableSource<?> other) {
super(actual, other);
Reported by PMD.
Line: 180
final AtomicInteger wip;
volatile boolean done;
SampleMainEmitLast(Observer<? super T> actual, ObservableSource<?> other) {
super(actual, other);
this.wip = new AtomicInteger();
}
Reported by PMD.
Line: 18
import java.util.concurrent.atomic.*;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;
import io.reactivex.rxjava3.observers.SerializedObserver;
public final class ObservableSampleWithObservable<T> extends AbstractObservableWithUpstream<T, T> {
Reported by PMD.
src/main/java/io/reactivex/rxjava3/internal/jdk8/MaybeMapOptional.java
10 issues
Line: 33
*/
public final class MaybeMapOptional<T, R> extends Maybe<R> {
final Maybe<T> source;
final Function<? super T, Optional<? extends R>> mapper;
public MaybeMapOptional(Maybe<T> source, Function<? super T, Optional<? extends R>> mapper) {
this.source = source;
Reported by PMD.
Line: 35
final Maybe<T> source;
final Function<? super T, Optional<? extends R>> mapper;
public MaybeMapOptional(Maybe<T> source, Function<? super T, Optional<? extends R>> mapper) {
this.source = source;
this.mapper = mapper;
}
Reported by PMD.
Line: 49
static final class MapOptionalMaybeObserver<T, R> implements MaybeObserver<T>, Disposable {
final MaybeObserver<? super R> downstream;
final Function<? super T, Optional<? extends R>> mapper;
Disposable upstream;
Reported by PMD.
Line: 51
final MaybeObserver<? super R> downstream;
final Function<? super T, Optional<? extends R>> mapper;
Disposable upstream;
MapOptionalMaybeObserver(MaybeObserver<? super R> downstream, Function<? super T, Optional<? extends R>> mapper) {
this.downstream = downstream;
Reported by PMD.
Line: 53
final Function<? super T, Optional<? extends R>> mapper;
Disposable upstream;
MapOptionalMaybeObserver(MaybeObserver<? super R> downstream, Function<? super T, Optional<? extends R>> mapper) {
this.downstream = downstream;
this.mapper = mapper;
}
Reported by PMD.
Line: 64
public void dispose() {
Disposable d = this.upstream;
this.upstream = DisposableHelper.DISPOSED;
d.dispose();
}
@Override
public boolean isDisposed() {
return upstream.isDisposed();
Reported by PMD.
Line: 87
try {
v = Objects.requireNonNull(mapper.apply(value), "The mapper returned a null item");
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
downstream.onError(ex);
return;
}
Reported by PMD.
Line: 93
return;
}
if (v.isPresent()) {
downstream.onSuccess(v.get());
} else {
downstream.onComplete();
}
}
Reported by PMD.
Line: 18
import java.util.*;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;
Reported by PMD.
Line: 86
Optional<? extends R> v;
try {
v = Objects.requireNonNull(mapper.apply(value), "The mapper returned a null item");
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
downstream.onError(ex);
return;
}
Reported by PMD.
src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFlattenIterable.java
10 issues
Line: 34
*/
public final class ObservableFlattenIterable<T, R> extends AbstractObservableWithUpstream<T, R> {
final Function<? super T, ? extends Iterable<? extends R>> mapper;
public ObservableFlattenIterable(ObservableSource<T> source,
Function<? super T, ? extends Iterable<? extends R>> mapper) {
super(source);
this.mapper = mapper;
Reported by PMD.
Line: 48
}
static final class FlattenIterableObserver<T, R> implements Observer<T>, Disposable {
final Observer<? super R> downstream;
final Function<? super T, ? extends Iterable<? extends R>> mapper;
Disposable upstream;
Reported by PMD.
Line: 50
static final class FlattenIterableObserver<T, R> implements Observer<T>, Disposable {
final Observer<? super R> downstream;
final Function<? super T, ? extends Iterable<? extends R>> mapper;
Disposable upstream;
FlattenIterableObserver(Observer<? super R> actual, Function<? super T, ? extends Iterable<? extends R>> mapper) {
this.downstream = actual;
Reported by PMD.
Line: 52
final Function<? super T, ? extends Iterable<? extends R>> mapper;
Disposable upstream;
FlattenIterableObserver(Observer<? super R> actual, Function<? super T, ? extends Iterable<? extends R>> mapper) {
this.downstream = actual;
this.mapper = mapper;
}
Reported by PMD.
Line: 77
Iterator<? extends R> it;
try {
it = mapper.apply(value).iterator();
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
upstream.dispose();
onError(ex);
return;
Reported by PMD.
Line: 78
try {
it = mapper.apply(value).iterator();
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
upstream.dispose();
onError(ex);
return;
}
Reported by PMD.
Line: 92
try {
b = it.hasNext();
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
upstream.dispose();
onError(ex);
return;
}
Reported by PMD.
Line: 104
try {
v = Objects.requireNonNull(it.next(), "The iterator returned a null value");
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
upstream.dispose();
onError(ex);
return;
}
Reported by PMD.
Line: 19
import java.util.Iterator;
import java.util.Objects;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.Exceptions;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.disposables.DisposableHelper;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
Reported by PMD.
Line: 77
Iterator<? extends R> it;
try {
it = mapper.apply(value).iterator();
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
upstream.dispose();
onError(ex);
return;
Reported by PMD.