Skip to content

find(...): NoSuchElementException for existed object #58

@ghost

Description

Hi again! ;)

Sometimes when I trying to find an object like this:

    fun get(localId: UUID) = Single.fromCallable {
        repository.find(
                ObjectFilters.eq(CaObject::localId.name, localId)
        ).first()
    }

I get java.util.NoSuchElementException: Collection is empty. exception while object with such id exists and the rest of the time successfully queried.

	Caused by: java.util.NoSuchElementException: Collection is empty.
	   at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:166)
	   at eu.cortex.cortexalarm.data.daos.caobjects.CaObjectsDao$get$1.call(CaObjectsDao.kt:46)
	   at eu.cortex.cortexalarm.data.daos.caobjects.CaObjectsDao$get$1.call(CaObjectsDao.kt:17)
	   at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:44)

It happens sometimes when I trying to find object just after upserting with the same id on the last SNAPSHOT and 2.1.1.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions