This is an automated email from the ASF dual-hosted git repository.
He-Pin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-persistence-jdbc.git
The following commit(s) were added to refs/heads/main by this push:
new 85eeaca5 chore: use StandardCharsets.UTF_8 (#558)
85eeaca5 is described below
commit 85eeaca501771b5a30b1ef6e6030ddb5d38c33eb
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Mon Jul 6 21:58:47 2026 +0800
chore: use StandardCharsets.UTF_8 (#558)
Motivation:\nAvoid stringly-typed UTF-8 charset usage in encoding and
decoding code paths.\n\nModification:\nReplace UTF-8 charset string arguments
with StandardCharsets.UTF_8 and normalize touched XML declarations where
applicable.\n\nResult:\nCharset usage is type-safe and exact lowercase "utf-8"
string literals are removed from the touched areas.
---
.../scala/org/apache/pekko/persistence/jdbc/state/Payloads.scala | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/Payloads.scala
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/Payloads.scala
index 911da601..d8b7c7e7 100644
--- a/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/Payloads.scala
+++ b/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/Payloads.scala
@@ -14,6 +14,8 @@
package org.apache.pekko.persistence.jdbc.state
+import java.nio.charset.StandardCharsets
+
import org.apache.pekko.serialization._
final case class MyPayload(data: String)
@@ -25,12 +27,12 @@ class MyPayloadSerializer extends Serializer {
def includeManifest: Boolean = true
def toBinary(o: AnyRef): Array[Byte] = o match {
- case MyPayload(data) => s"$data".getBytes("UTF-8")
+ case MyPayload(data) => s"$data".getBytes(StandardCharsets.UTF_8)
case _ => throw new Exception("Unknown object for
serialization")
}
def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]): AnyRef =
manifest match {
- case Some(MyPayloadClass) => MyPayload(s"${new String(bytes, "UTF-8")}")
+ case Some(MyPayloadClass) => MyPayload(s"${new String(bytes,
StandardCharsets.UTF_8)}")
case Some(c) => throw new Exception(s"unexpected manifest $c")
case None => throw new Exception("no manifest")
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]