This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch 1.0.x
in repository https://gitbox.apache.org/repos/asf/incubator-pekko.git
The following commit(s) were added to refs/heads/1.0.x by this push:
new a934df3cdd Use recoverWith instead of recover in SnapshotSerializer
akka backwards compatibility (#841)
a934df3cdd is described below
commit a934df3cdd3ae7a9940e99e72478f6eba1106476
Author: Ćukasz Krenski <[email protected]>
AuthorDate: Mon Dec 11 12:01:51 2023 +0100
Use recoverWith instead of recover in SnapshotSerializer akka backwards
compatibility (#841)
---
.../pekko/persistence/serialization/SnapshotSerializer.scala | 2 +-
.../pekko/persistence/serialization/SnapshotSerializerSpec.scala | 7 ++-----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git
a/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala
b/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala
index e8e1c11927..d9926f2a35 100644
---
a/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala
+++
b/persistence/src/main/scala/org/apache/pekko/persistence/serialization/SnapshotSerializer.scala
@@ -115,7 +115,7 @@ class SnapshotSerializer(val system: ExtendedActorSystem)
extends BaseSerializer
// suggested in
https://github.com/scullxbones/pekko-persistence-mongo/pull/14#issuecomment-1847223850
serialization
.deserialize(snapshotBytes, serializerId, manifest)
- .recover {
+ .recoverWith {
case _: NotSerializableException if manifest.startsWith("akka") =>
serialization
.deserialize(snapshotBytes, serializerId,
manifest.replaceFirst("akka", "org.apache.pekko"))
diff --git
a/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala
b/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala
index 824ff9c51f..bcadc2e8bd 100644
---
a/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala
+++
b/persistence/src/test/scala/org/apache/pekko/persistence/serialization/SnapshotSerializerSpec.scala
@@ -24,7 +24,6 @@ import pekko.serialization.SerializationExtension
import pekko.testkit.PekkoSpec
import java.util.Base64
-import scala.util.Success
class SnapshotSerializerSpec extends PekkoSpec {
@@ -38,10 +37,8 @@ class SnapshotSerializerSpec extends PekkoSpec {
val bytes = Base64.getDecoder.decode(data)
val result = serialization.deserialize(bytes, classOf[Snapshot]).get
val deserialized = result.data
- deserialized shouldBe a[Success[_]]
- val innerResult = deserialized.asInstanceOf[Success[_]].get
- innerResult shouldBe a[PersistentFSMSnapshot[_]]
- val persistentFSMSnapshot =
innerResult.asInstanceOf[PersistentFSMSnapshot[_]]
+ deserialized shouldBe a[PersistentFSMSnapshot[_]]
+ val persistentFSMSnapshot =
deserialized.asInstanceOf[PersistentFSMSnapshot[_]]
persistentFSMSnapshot shouldEqual
PersistentFSMSnapshot[String]("test-identifier", "test-data", None)
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]