@Test public void onErrorNoSubscribeCrash() { List<Throwable> list = TestHelper.trackPluginErrors(); try { CrashDummy cd = new CrashDummy(true, 1, false, false, false, false); SafeSubscriber<Object> so = cd.toSafe(); so.onError(new TestException()); TestHelper.assertError(list, 0, CompositeException.class); List<Throwable> ce = TestHelper.compositeList(list.get(0)); TestHelper.assertError(ce, 0, TestException.class); TestHelper.assertError(ce, 1, NullPointerException.class, "Subscription not set!"); } finally { RxJavaPlugins.reset(); } }
@Override public void onError(Throwable t) { if (done) { RxJavaPlugins.onError(t); return; } done = true; if (s == null) { Throwable npe = new NullPointerException("Subscription not set!"); try { actual.onSubscribe(EmptySubscription.INSTANCE); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, npe, e)); return; } try { actual.onError(new CompositeException(t, npe)); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, npe, e)); } return; } if (t == null) { t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); } try { actual.onError(t); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaPlugins.onError(new CompositeException(t, ex)); } }
SafeSubscriber implements FlowableSubscriber<T>, Subscription { @Override public void onError(Throwable t) { if (done) { RxJavaPlugins.onError(t); return; } done = true; if (s == null) { Throwable npe = new NullPointerException("Subscription not set!"); try { actual.onSubscribe(EmptySubscription.INSTANCE); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, npe, e)); return; } try { actual.onError(new CompositeException(t, npe)); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, npe, e)); } return; } if (t == null) { t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); } try { actual.onError(t); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaPlugins.onError(new CompositeException(t, ex)); } } }
SafeSubscriber implements FlowableSubscriber<T>, Subscription { @Override public void onError(Throwable t) { if (done) { RxJavaPlugins.onError(t); return; } done = true; if (s == null) { Throwable npe = new NullPointerException("Subscription not set!"); try { actual.onSubscribe(EmptySubscription.INSTANCE); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, npe, e)); return; } try { actual.onError(new CompositeException(t, npe)); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, npe, e)); } return; } if (t == null) { t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); } try { actual.onError(t); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaPlugins.onError(new CompositeException(t, ex)); } } SafeSubscriber(Subscriber<? super T> actual); }
SafeSubscriber implements FlowableSubscriber<T>, Subscription { @Override public void onError(Throwable t) { if (done) { RxJavaPlugins.onError(t); return; } done = true; if (s == null) { Throwable npe = new NullPointerException("Subscription not set!"); try { actual.onSubscribe(EmptySubscription.INSTANCE); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, npe, e)); return; } try { actual.onError(new CompositeException(t, npe)); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, npe, e)); } return; } if (t == null) { t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); } try { actual.onError(t); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaPlugins.onError(new CompositeException(t, ex)); } } SafeSubscriber(Subscriber<? super T> actual); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void request(long n); @Override void cancel(); }
SafeSubscriber implements FlowableSubscriber<T>, Subscription { @Override public void onError(Throwable t) { if (done) { RxJavaPlugins.onError(t); return; } done = true; if (s == null) { Throwable npe = new NullPointerException("Subscription not set!"); try { actual.onSubscribe(EmptySubscription.INSTANCE); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, npe, e)); return; } try { actual.onError(new CompositeException(t, npe)); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(new CompositeException(t, npe, e)); } return; } if (t == null) { t = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); } try { actual.onError(t); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); RxJavaPlugins.onError(new CompositeException(t, ex)); } } SafeSubscriber(Subscriber<? super T> actual); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void request(long n); @Override void cancel();  }