Skip to content

Commit c8e3780

Browse files
authored
[RKOTLIN-1102] Remove nullability check in SubscriptionSetImpl.waitForSynchronization (#1778)
1 parent 422d9cb commit c8e3780

File tree

7 files changed

+10
-9
lines changed

7 files changed

+10
-9
lines changed

.github/workflows/include-check-cache.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
# This also include changes to Realm Core as they are hashed as part of `/packages/external/core`
9494
- name: Calculate ./packages SHAs
9595
id: packages-cache-key
96-
run: echo "sha=${{ hashFiles('./packages/**', './buildSrc/**', '!./packages/test-base/**', '!./packages/test-sync/**') }}" >> $GITHUB_OUTPUT
96+
run: echo "sha=${{ hashFiles('./packages/**', './buildSrc/**') }}" >> $GITHUB_OUTPUT
9797

9898
- name: Calculate ./benchmarks SHAs
9999
id: calculate-benchmarks-cache-key

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Fixed
1010
* [Sync] Fatal sync exceptions are now thrown as `UnrecoverableSyncException`. (Issue [#1767](https://github.com/realm/realm-kotlin/issues/1767) [RKOTLIN-1096](https://jira.mongodb.org/browse/RKOTLIN-1096)).
11+
* [Sync] Fix `NullPointerException` in `SubscriptionSet.waitForSynchronization`. (Issue [#1777](https://github.com/realm/realm-kotlin/issues/1777) [RKOTLIN-1102](https://jira.mongodb.org/browse/RKOTLIN-1102)).
1112

1213
### Compatibility
1314
* File format: Generates Realms with file format v24 (reads and upgrades file format v10 or later).

packages/library-base/src/commonMain/kotlin/io/realm/kotlin/exceptions/RealmException.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package io.realm.kotlin.exceptions
99
*/
1010
public open class RealmException : RuntimeException {
1111
public constructor() : super()
12-
public constructor(message: String) : super(message)
13-
public constructor(message: String, cause: Throwable) : super(message, cause)
14-
public constructor(cause: Throwable) : super(cause)
12+
public constructor(message: String?) : super(message)
13+
public constructor(message: String?, cause: Throwable?) : super(message, cause)
14+
public constructor(cause: Throwable?) : super(cause)
1515
}

packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/exceptions/AppException.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@ import io.realm.kotlin.exceptions.RealmException
9494
* @see SyncException
9595
*/
9696
public open class AppException internal constructor(
97-
message: String,
97+
message: String?,
9898
) : RealmException(message)

packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/exceptions/SyncExceptions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import io.realm.kotlin.types.RealmAny
3131
*
3232
* @see io.realm.kotlin.mongodb.sync.SyncConfiguration.Builder.errorHandler
3333
*/
34-
public open class SyncException internal constructor(message: String) : AppException(message)
34+
public open class SyncException internal constructor(message: String?) : AppException(message)
3535

3636
/**
3737
* Thrown when something has gone wrong with Device Sync in a way that is not recoverable.
@@ -60,7 +60,7 @@ public class WrongSyncTypeException internal constructor(message: String) : Sync
6060
* Thrown when the server does not support one or more of the queries defined in the
6161
* [io.realm.kotlin.mongodb.sync.SubscriptionSet].
6262
*/
63-
public class BadFlexibleSyncQueryException internal constructor(message: String) :
63+
public class BadFlexibleSyncQueryException internal constructor(message: String?) :
6464
SyncException(message)
6565

6666
/**

packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/internal/SubscriptionSetImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ internal class SubscriptionSetImpl<T : BaseRealm>(
127127
if (result) {
128128
return true
129129
} else {
130-
throw BadFlexibleSyncQueryException(errorMessage!!)
130+
throw BadFlexibleSyncQueryException(errorMessage)
131131
}
132132
}
133133
else -> throw IllegalStateException("Unexpected value: $result")

packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/CredentialsTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class CredentialsTests {
369369
payload = mapOf("mail" to TestHelper.randomEmail(), "id" to 0)
370370
)
371371

372-
assertFailsWithMessage<AuthException>("unauthorized") {
372+
assertFailsWithMessage<AuthException>("Authentication failed") {
373373
runBlocking {
374374
app.login(credentials)
375375
}

0 commit comments

Comments
 (0)