File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 1919
2020import rx .Subscriber ;
2121import rx .exceptions .*;
22- import rx .plugins .RxJavaHooks ;
22+ import rx .plugins .* ;
2323
2424/**
2525 * {@code SafeSubscriber} is a wrapper around {@code Subscriber} that ensures that the {@code Subscriber}
@@ -146,8 +146,9 @@ public void onNext(T args) {
146146 *
147147 * @see <a href="https://github.com/ReactiveX/RxJava/issues/630">the report of this bug</a>
148148 */
149+ @ SuppressWarnings ("deprecation" )
149150 protected void _onError (Throwable e ) { // NOPMD
150- RxJavaHooks . onError (e );
151+ RxJavaPlugins . getInstance (). getErrorHandler (). handleError (e );
151152 try {
152153 actual .onError (e );
153154 } catch (OnErrorNotImplementedException e2 ) { // NOPMD
Original file line number Diff line number Diff line change @@ -1084,4 +1084,25 @@ public Completable.Operator onLift(Completable.Operator lift) {
10841084 }
10851085 }
10861086
1087+ @ Test
1088+ public void noCallToHooksOnPlainError () {
1089+
1090+ final boolean [] called = { false };
1091+
1092+ RxJavaHooks .setOnError (new Action1 <Throwable >() {
1093+ @ Override
1094+ public void call (Throwable t ) {
1095+ called [0 ] = true ;
1096+ }
1097+ });
1098+
1099+ try {
1100+ Observable .error (new TestException ())
1101+ .subscribe (new TestSubscriber <Object >());
1102+
1103+ assertFalse (called [0 ]);
1104+ } finally {
1105+ RxJavaHooks .reset ();
1106+ }
1107+ }
10871108}
You can’t perform that action at this time.
0 commit comments