File tree Expand file tree Collapse file tree
rxjava-core/src/main/java/rx/operators Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,17 +111,22 @@ public Object error(Throwable e) {
111111 * @throws NullPointerException
112112 * if the {@link Observer} is null.
113113 */
114+ @ SuppressWarnings ("unchecked" )
114115 public void accept (Observer <? super T > o , Object n ) {
115- switch (kind (n )) {
116- case OnNext :
117- o .onNext (getValue (n ));
118- break ;
119- case OnCompleted :
116+ if (n == ON_COMPLETED_SENTINEL ) {
120117 o .onCompleted ();
121- break ;
122- case OnError :
123- o .onError (getError (n ));
124- break ;
118+ } else
119+ if (n == ON_NEXT_NULL_SENTINEL ) {
120+ o .onNext (null );
121+ } else
122+ if (n != null ) {
123+ if (n .getClass () == OnErrorSentinel .class ) {
124+ o .onError (((OnErrorSentinel )n ).e );
125+ } else {
126+ o .onNext ((T )n );
127+ }
128+ } else {
129+ throw new IllegalArgumentException ("The lite notification can not be null" );
125130 }
126131 }
127132
You can’t perform that action at this time.
0 commit comments