Fixed
Status Update
Comments
da...@google.com <da...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit b2dde00cacbbb6e82822c9d02da233c0589a9609
Author: Elif Bilgin <elifbilgin@google.com>
Date: Wed Nov 24 16:36:19 2021
Converting room-migration from Java to Kotlin.
Test: All tests in the room-migration directory.
Bug: 206858622
Relnote: Converting room-migration from Java to Kotlin.
Change-Id: I2724b688fc6dcd3c632dfe167364924edc5248b9
A room/room-migration/api/restricted_current.ignore
M room/room-compiler/src/main/kotlin/androidx/room/vo/Entity.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/SchemaEqualityUtil.kt
M room/room-compiler/src/test/kotlin/androidx/room/util/SchemaDifferTest.kt
M room/room-migration/build.gradle
M room/room-migration/src/test/java/androidx/room/migration/bundle/IndexBundleTest.kt
M room/room-migration/api/restricted_current.txt
M room/room-migration/src/main/java/androidx/room/migration/bundle/DatabaseViewBundle.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/EntityBundleTest.kt
M room/room-compiler/src/main/kotlin/androidx/room/vo/DatabaseView.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/SchemaEquality.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/BundleUtil.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/ForeignKeyBundle.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/IndexBundle.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/PrimaryKeyBundleTest.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/PrimaryKeyBundle.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/FieldBundleTest.kt
M room/room-compiler/src/main/kotlin/androidx/room/vo/FtsEntity.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/EntityBundle.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/DatabaseViewBundleTest.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/FtsOptionsBundle.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/SchemaBundle.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/FieldBundle.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/DatabaseBundle.kt
M room/room-compiler/src/main/kotlin/androidx/room/vo/Index.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/ForeignKeyBundleTest.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/FtsEntityBundle.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/DatabaseBundleTest.kt
https://android-review.googlesource.com/1902291
Branch: androidx-main
commit b2dde00cacbbb6e82822c9d02da233c0589a9609
Author: Elif Bilgin <elifbilgin@google.com>
Date: Wed Nov 24 16:36:19 2021
Converting room-migration from Java to Kotlin.
Test: All tests in the room-migration directory.
Bug: 206858622
Relnote: Converting room-migration from Java to Kotlin.
Change-Id: I2724b688fc6dcd3c632dfe167364924edc5248b9
A room/room-migration/api/restricted_current.ignore
M room/room-compiler/src/main/kotlin/androidx/room/vo/Entity.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/SchemaEqualityUtil.kt
M room/room-compiler/src/test/kotlin/androidx/room/util/SchemaDifferTest.kt
M room/room-migration/build.gradle
M room/room-migration/src/test/java/androidx/room/migration/bundle/IndexBundleTest.kt
M room/room-migration/api/restricted_current.txt
M room/room-migration/src/main/java/androidx/room/migration/bundle/DatabaseViewBundle.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/EntityBundleTest.kt
M room/room-compiler/src/main/kotlin/androidx/room/vo/DatabaseView.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/SchemaEquality.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/BundleUtil.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/ForeignKeyBundle.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/IndexBundle.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/PrimaryKeyBundleTest.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/PrimaryKeyBundle.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/FieldBundleTest.kt
M room/room-compiler/src/main/kotlin/androidx/room/vo/FtsEntity.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/EntityBundle.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/DatabaseViewBundleTest.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/FtsOptionsBundle.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/SchemaBundle.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/FieldBundle.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/DatabaseBundle.kt
M room/room-compiler/src/main/kotlin/androidx/room/vo/Index.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/ForeignKeyBundleTest.kt
M room/room-migration/src/main/java/androidx/room/migration/bundle/FtsEntityBundle.kt
M room/room-migration/src/test/java/androidx/room/migration/bundle/DatabaseBundleTest.kt
[Deleted User] <[Deleted User]> #3
You can still do that with Single.create. It has an emitter.onError that sends the exception to the global error handler and it also has an emitter.tryOnError that only sends the exception to the observer if he's still there.
EmptyResultSetException being very specific to the query being made, should only matter if the observer that requested the query is still waiting for the response. I don't think this exception should ever end up in the global error handler (except if you don't register an onError handler for that subscription) because it is not something catastrophic, it's just a possible value.
EmptyResultSetException being very specific to the query being made, should only matter if the observer that requested the query is still waiting for the response. I don't think this exception should ever end up in the global error handler (except if you don't register an onError handler for that subscription) because it is not something catastrophic, it's just a possible value.
da...@google.com <da...@google.com> #4
Ok - That sounds reasonable, we can update the RxRoom (https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/room/rxjava2/src/main/java/androidx/room/RxRoom.java ) to have helper functions to set this up and then have generated code use a createSingle() function instead of Single.fromCallable.
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 20c288936ee61342a58b3fa24ad944dc16abd847
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Jun 05 13:16:34 2019
Use RxRoom.createSingle() instead of Single.fromCallable() in @Query.
For Dao queries whose return type is Single use a gen code api for
creating the Single that does not propagate the EmptyResultSetException
if the stream is already disposed.
Bug: 130257475
Test: RxJava2Test
Change-Id: I72beec305d484306e755e7b142c693f39ee82c84
M buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/RxCallableQueryResultBinder.kt
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/RxJava2Test.java
M room/rxjava2/api/restricted_2.2.0-alpha01.txt
M room/rxjava2/api/restricted_current.txt
M room/rxjava2/src/main/java/androidx/room/RxRoom.java
https://android-review.googlesource.com/977034
https://goto.google.com/android-sha1/20c288936ee61342a58b3fa24ad944dc16abd847
Branch: androidx-master-dev
commit 20c288936ee61342a58b3fa24ad944dc16abd847
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Jun 05 13:16:34 2019
Use RxRoom.createSingle() instead of Single.fromCallable() in @Query.
For Dao queries whose return type is Single use a gen code api for
creating the Single that does not propagate the EmptyResultSetException
if the stream is already disposed.
Bug: 130257475
Test: RxJava2Test
Change-Id: I72beec305d484306e755e7b142c693f39ee82c84
M buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/RxCallableQueryResultBinder.kt
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/RxJava2Test.java
M room/rxjava2/api/restricted_2.2.0-alpha01.txt
M room/rxjava2/api/restricted_current.txt
M room/rxjava2/src/main/java/androidx/room/RxRoom.java
Description
Version used: 2.1.0-alpha06
Devices/Android versions reproduced on: Doesn't matter
Using a Single in a Dao makes Room generate a Single.fromCallable. The docs in Single.fromCallable say:
If the {@link Callable} throws an exception, the respective {@link Throwable} is
delivered to the downstream via {@link SingleObserver#onError(Throwable)},
except when the downstream has disposed this {@code Single} source.
In this latter case, the {@code Throwable} is delivered to the global error handler via
{@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.exceptions.UndeliverableException UndeliverableException}.
If we subscribe to a Single and dispose before it delivers the EmptyResultSetException, will cause the exception to be sent to the global error handler, which means it will crash.
I think this could be avoided by using Single.create and checking if the emitter still has observers before trying to emit the error.
Can't provide a sample because this is a timing issue.