Android java.util.NoSuchElementException:源发布服务器为空

Android java.util.NoSuchElementException:源发布服务器为空,android,kotlin,rx-java,rx-java2,dbflow,Android,Kotlin,Rx Java,Rx Java2,Dbflow,我有例外的问题 getCurrentUpdateDateFromStorage()java.util.NoSuchElementException:源发布服务器为空 代码运行了很长时间,今天我遇到了这个问题 private fun getCurrentUpdateDateFromStorage(sentDate: Date) { LogMgr.d(TAG, "getCurrentUpdateDateFromStorage()") val flotaUserId = getCu

我有例外的问题

getCurrentUpdateDateFromStorage()java.util.NoSuchElementException:源发布服务器为空

代码运行了很长时间,今天我遇到了这个问题

  private fun getCurrentUpdateDateFromStorage(sentDate: Date) {
    LogMgr.d(TAG, "getCurrentUpdateDateFromStorage()")
    val flotaUserId = getCurrentFlotaUserId()

    if (flotaUserId > 0) {
        compositeDisposable.add(wfmStorageDomain.getLastUpdateDate(flotaUserId)
                .subscribe(
                        { lastLocalUpdateDate ->
                            LogMgr.d(TAG, "lastLocalUpdateDate: $lastLocalUpdateDate, time: " + (lastLocalUpdateDate?.time
                                    ?: "null"))
                            if (lastLocalUpdateDate == null || lastLocalUpdateDate.time < sentDate.time) {
                                LogMgr.d(TAG, "update needs to be done")
                                updateEventPlannersFromServer(lastLocalUpdateDate)
                            } else {
                                LogMgr.d(TAG, "update not necessary, or invalid data -> localDate:$lastLocalUpdateDate : sentDate:$sentDate")
                            }
                        },
                        { error ->
                            LogMgr.e(TAG, "getCurrentUpdateDateFromStorage() $error")
                        }))
    } else {
        LogMgr.e(TAG, "getCurrentUpdateDateFromStorage() Invalid flotaUserId:$flotaUserId")
    }
}

确切的堆栈跟踪是什么?还有,为什么不使用
Single.create
而不是不正确的
Single.fromPublisher
?@akarnokd Stacktrace addedOK。Single.create显示问题所在。服务器发送错误的json,订阅服务器.onNext()无法发出发布服务器版本的日期。
   override fun getLastUpdateDate(flotaUserId: Int): Single<Date> {
    LogMgr.d(TAG, "getLastUpdateDate(): $flotaUserId")
    return Single.fromPublisher({ subscriber ->
        RXSQLite.rx(
                SQLite.select().from(EventPlanner::class.java)
                        .orderBy(EventPlanner_Table.sentDate, false))
                .queryList()
                .subscribeOn(getSubscriptionScheduler())
                .subscribe({ eventPlanner ->
                    LogMgr.d(TAG, "getLastUpdateDate() $eventPlanner")

                    if (eventPlanner.isEmpty()) {
                        subscriber.onNext(Date(0L))
                    } else {
                        subscriber.onNext(eventPlanner[0].sentDate)
                    }
                    subscriber.onComplete()
                }, { error ->
                    LogMgr.e(TAG, "getLastUpdateDate()", error)
                    subscriber.onError(error)
                })
    })
}
java.util.NoSuchElementException: The source Publisher is empty
    at io.reactivex.internal.operators.single.SingleFromPublisher$ToSingleObserver.onComplete(SingleFromPublisher.java:99)
    at com.fs.wfm.storage.dbflow.DBFlowWfmStorageRepo$getLastUpdateDate$1$1.accept(DBFlowWfmStorageRepo.kt:211)
    at com.fs.wfm.storage.dbflow.DBFlowWfmStorageRepo$getLastUpdateDate$1$1.accept(DBFlowWfmStorageRepo.kt:22)
    at io.reactivex.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:63)
    at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.onSuccess(SingleSubscribeOn.java:68)
    at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:56)
    at io.reactivex.Single.subscribe(Single.java:3310)
    at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
    at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:579)
    at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
    at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)