diff --git a/.pubnub.yml b/.pubnub.yml index b899ae1fa..f5bf7ceee 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,9 +1,9 @@ name: kotlin -version: 9.2.2 +version: 9.2.3 schema: 1 scm: github.com/pubnub/kotlin files: - - build/libs/pubnub-kotlin-9.2.2-all.jar + - build/libs/pubnub-kotlin-9.2.3-all.jar sdks: - type: library @@ -23,8 +23,8 @@ sdks: - distribution-type: library distribution-repository: maven - package-name: pubnub-kotlin-9.2.2 - location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/9.2.2/pubnub-kotlin-9.2.2.jar + package-name: pubnub-kotlin-9.2.3 + location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/9.2.3/pubnub-kotlin-9.2.3.jar supported-platforms: supported-operating-systems: Android: @@ -114,6 +114,11 @@ sdks: license-url: https://www.apache.org/licenses/LICENSE-2.0.txt is-required: Required changelog: + - date: 2024-07-29 + version: v9.2.3 + changes: + - type: bug + text: "Fixed incorrect multiple callbacks (with exception) when sending files." - date: 2024-07-04 version: v9.2.2 changes: diff --git a/CHANGELOG.md b/CHANGELOG.md index 756fcbc2b..5e6c60325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v9.2.3 +July 29 2024 + +#### Fixed +- Fixed incorrect multiple callbacks (with exception) when sending files. + ## v9.2.2 July 04 2024 diff --git a/README.md b/README.md index 0d272eccf..8de582891 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,13 @@ You will need the publish and subscribe keys to authenticate your app. Get your com.pubnub pubnub-kotlin - 9.2.2 + 9.2.3 ``` * for Gradle, add the following dependency in your `gradle.build`: ```groovy - implementation 'com.pubnub:pubnub-kotlin:9.2.2' + implementation 'com.pubnub:pubnub-kotlin:9.2.3' ``` 2. Configure your keys and create PubNub instance: diff --git a/gradle.properties b/gradle.properties index f2685c165..73b7acd10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ RELEASE_SIGNING_ENABLED=true SONATYPE_HOST=DEFAULT SONATYPE_AUTOMATIC_RELEASE=false GROUP=com.pubnub -VERSION_NAME=9.2.2 +VERSION_NAME=9.2.3 POM_PACKAGING=jar POM_NAME=PubNub SDK diff --git a/pubnub-core/pubnub-core-impl/src/main/kotlin/com/pubnub/internal/endpoints/remoteaction/RetryingRemoteAction.kt b/pubnub-core/pubnub-core-impl/src/main/kotlin/com/pubnub/internal/endpoints/remoteaction/RetryingRemoteAction.kt index 27a417203..5759b6e50 100644 --- a/pubnub-core/pubnub-core-impl/src/main/kotlin/com/pubnub/internal/endpoints/remoteaction/RetryingRemoteAction.kt +++ b/pubnub-core/pubnub-core-impl/src/main/kotlin/com/pubnub/internal/endpoints/remoteaction/RetryingRemoteAction.kt @@ -46,11 +46,14 @@ internal class RetryingRemoteAction( for (i in 0 until maxNumberOfAutomaticRetries) { try { callback.accept(Result.success(remoteAction.sync())) + return@Runnable } catch (e: Throwable) { lastException = e } } - callback.accept(Result.failure(PubNubException.from(lastException!!).copy(remoteAction = this))) + lastException?.let { exception -> + callback.accept(Result.failure(PubNubException.from(exception).copy(remoteAction = this))) + } }, ) } diff --git a/pubnub-core/pubnub-core-impl/src/test/kotlin/com/pubnub/api/legacy/PubNubCoreTest.kt b/pubnub-core/pubnub-core-impl/src/test/kotlin/com/pubnub/api/legacy/PubNubCoreTest.kt index f9b8b8742..5f414f7ab 100644 --- a/pubnub-core/pubnub-core-impl/src/test/kotlin/com/pubnub/api/legacy/PubNubCoreTest.kt +++ b/pubnub-core/pubnub-core-impl/src/test/kotlin/com/pubnub/api/legacy/PubNubCoreTest.kt @@ -66,7 +66,7 @@ class PubNubCoreTest : BaseTest() { fun getVersionAndTimeStamp() { val version = PubNubCore.SDK_VERSION val timeStamp = PubNubCore.timestamp() - assertEquals("9.2.2", version) + assertEquals("9.2.3", version) assertTrue(timeStamp > 0) } diff --git a/pubnub-core/pubnub-core-impl/src/test/kotlin/com/pubnub/api/legacy/endpoints/remoteaction/RetryingRemoteActionTest.kt b/pubnub-core/pubnub-core-impl/src/test/kotlin/com/pubnub/api/legacy/endpoints/remoteaction/RetryingRemoteActionTest.kt index 593bea5b1..154cbcabf 100644 --- a/pubnub-core/pubnub-core-impl/src/test/kotlin/com/pubnub/api/legacy/endpoints/remoteaction/RetryingRemoteActionTest.kt +++ b/pubnub-core/pubnub-core-impl/src/test/kotlin/com/pubnub/api/legacy/endpoints/remoteaction/RetryingRemoteActionTest.kt @@ -90,6 +90,7 @@ class RetryingRemoteActionTest { executorService, ) val asyncSynchronization = CountDownLatch(1) + val noFailureCallsSynchronization = CountDownLatch(1) // when retryingRemoteAction.async { result -> @@ -98,11 +99,17 @@ class RetryingRemoteActionTest { Assert.assertEquals(expectedValue, it) verify(exactly = 1) { remoteAction.sync() } asyncSynchronization.countDown() + }.onFailure { + noFailureCallsSynchronization.countDown() } } if (!asyncSynchronization.await(3, TimeUnit.SECONDS)) { Assert.fail("Callback have not been called") } + + if (noFailureCallsSynchronization.await(3, TimeUnit.SECONDS)) { + Assert.fail("onFailure has been called when it shouldn't!") + } } @Test