This is an automated email from the ASF dual-hosted git repository.

fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko.git


The following commit(s) were added to refs/heads/main by this push:
     new 6883d15576 use StandardCharsets (#934)
6883d15576 is described below

commit 6883d15576708e2d9f8294641a422e6e9756abe4
Author: PJ Fanning <[email protected]>
AuthorDate: Sat Jan 13 12:40:16 2024 +0100

    use StandardCharsets (#934)
---
 .../org/apache/pekko/remote/artery/LiteralEncodingBenchmark.scala | 4 ++--
 .../docs/persistence/PersistenceSchemaEvolutionDocSpec.scala      | 8 ++++----
 .../apache/pekko/remote/artery/tcp/ssl/PemManagersProvider.scala  | 4 ++--
 .../org/apache/pekko/remote/artery/MetadataCarryingSpec.scala     | 4 ++--
 .../pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala  | 4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git 
a/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/LiteralEncodingBenchmark.scala
 
b/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/LiteralEncodingBenchmark.scala
index 4ae8dba75e..865ab65331 100644
--- 
a/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/LiteralEncodingBenchmark.scala
+++ 
b/bench-jmh/src/main/scala/org/apache/pekko/remote/artery/LiteralEncodingBenchmark.scala
@@ -15,7 +15,7 @@ package org.apache.pekko.remote.artery
 
 import java.nio.ByteBuffer
 import java.nio.ByteOrder
-import java.nio.charset.Charset
+import java.nio.charset.StandardCharsets
 import java.util.concurrent.TimeUnit
 
 import org.openjdk.jmh.annotations._
@@ -30,7 +30,7 @@ import org.apache.pekko.util.Unsafe
 @Measurement(iterations = 10)
 class LiteralEncodingBenchmark {
 
-  private val UsAscii = Charset.forName("US-ASCII")
+  private val UsAscii = StandardCharsets.US_ASCII
   private val str = "pekko://SomeSystem@host12:1234/user/foo"
   private val buffer = ByteBuffer.allocate(128).order(ByteOrder.LITTLE_ENDIAN)
   private val literalChars = Array.ofDim[Char](64)
diff --git 
a/docs/src/test/scala/docs/persistence/PersistenceSchemaEvolutionDocSpec.scala 
b/docs/src/test/scala/docs/persistence/PersistenceSchemaEvolutionDocSpec.scala
index 0859a40b95..3709de62e3 100644
--- 
a/docs/src/test/scala/docs/persistence/PersistenceSchemaEvolutionDocSpec.scala
+++ 
b/docs/src/test/scala/docs/persistence/PersistenceSchemaEvolutionDocSpec.scala
@@ -14,7 +14,7 @@
 package docs.persistence
 
 import java.io.NotSerializableException
-import java.nio.charset.Charset
+import java.nio.charset.StandardCharsets
 
 import org.apache.pekko.actor.ActorSystem
 import org.apache.pekko.persistence.journal.{ EventAdapter, EventSeq }
@@ -186,7 +186,7 @@ object SimplestCustomSerializer {
    * to perform the actual to/from bytes marshalling.
    */
   class SimplestPossiblePersonSerializer extends SerializerWithStringManifest {
-    val Utf8 = Charset.forName("UTF-8")
+    val Utf8 = StandardCharsets.UTF_8
 
     val PersonManifest = classOf[Person].getName
 
@@ -274,7 +274,7 @@ final case class CustomerBlinked(customerId: Long)
 case object EventDeserializationSkipped
 
 class RemovedEventsAwareSerializer extends SerializerWithStringManifest {
-  val utf8 = Charset.forName("UTF-8")
+  val utf8 = StandardCharsets.UTF_8
   override def identifier: Int = 8337
 
   val SkipEventManifestsEvents = Set("docs.persistence.CustomerBlinked" // ...
@@ -310,7 +310,7 @@ class SkippedEventsAwareAdapter extends EventAdapter {
 
 //#string-serializer-handle-rename
 class RenamedEventAwareSerializer extends SerializerWithStringManifest {
-  val Utf8 = Charset.forName("UTF-8")
+  val Utf8 = StandardCharsets.UTF_8
   override def identifier: Int = 8337
 
   val OldPayloadClassName = "docs.persistence.OldPayload" // class NOT 
available anymore
diff --git 
a/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/PemManagersProvider.scala
 
b/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/PemManagersProvider.scala
index 1a85bcb1c2..cd7306afcb 100644
--- 
a/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/PemManagersProvider.scala
+++ 
b/remote/src/main/scala/org/apache/pekko/remote/artery/tcp/ssl/PemManagersProvider.scala
@@ -15,7 +15,7 @@ package org.apache.pekko.remote.artery.tcp.ssl
 
 import java.io.ByteArrayInputStream
 import java.io.File
-import java.nio.charset.Charset
+import java.nio.charset.StandardCharsets
 import java.nio.file.Files
 import java.security.KeyStore
 import java.security.PrivateKey
@@ -83,7 +83,7 @@ private[ssl] object PemManagersProvider {
   @InternalApi
   private[ssl] def loadPrivateKey(filename: String): PrivateKey = blocking {
     val bytes = Files.readAllBytes(new File(filename).toPath)
-    val pemData = new String(bytes, Charset.forName("UTF-8"))
+    val pemData = new String(bytes, StandardCharsets.UTF_8)
     DERPrivateKeyLoader.load(PEMDecoder.decode(pemData))
   }
 
diff --git 
a/remote/src/test/scala/org/apache/pekko/remote/artery/MetadataCarryingSpec.scala
 
b/remote/src/test/scala/org/apache/pekko/remote/artery/MetadataCarryingSpec.scala
index f7983d7690..a1f50c4e92 100644
--- 
a/remote/src/test/scala/org/apache/pekko/remote/artery/MetadataCarryingSpec.scala
+++ 
b/remote/src/test/scala/org/apache/pekko/remote/artery/MetadataCarryingSpec.scala
@@ -14,7 +14,7 @@
 package org.apache.pekko.remote.artery
 
 import java.nio.{ ByteBuffer, CharBuffer }
-import java.nio.charset.Charset
+import java.nio.charset.StandardCharsets
 import java.util.concurrent.atomic.AtomicReference
 
 import org.apache.pekko
@@ -46,7 +46,7 @@ class MetadataCarryingSpy extends Extension {
 class TestInstrument(system: ExtendedActorSystem) extends RemoteInstrument {
   import pekko.remote.artery.MetadataCarryingSpy._
 
-  private val charset = Charset.forName("UTF-8")
+  private val charset = StandardCharsets.UTF_8
   private val encoder = charset.newEncoder()
   private val decoder = charset.newDecoder()
 
diff --git 
a/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala
 
b/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala
index 7150043642..fb76ecb83f 100644
--- 
a/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala
+++ 
b/remote/src/test/scala/org/apache/pekko/remote/artery/RemoteInstrumentsSerializationSpec.scala
@@ -14,7 +14,7 @@
 package org.apache.pekko.remote.artery
 
 import java.nio.{ ByteBuffer, CharBuffer }
-import java.nio.charset.Charset
+import java.nio.charset.StandardCharsets
 import scala.concurrent.duration._
 import org.apache.pekko
 import pekko.actor.{ ActorRef, ActorSystem, ExtendedActorSystem, 
InternalActorRef }
@@ -153,7 +153,7 @@ object RemoteInstrumentsSerializationSpec {
       sentThrowable: Throwable = null,
       receiveThrowable: Throwable = null): RemoteInstrument = {
     new RemoteInstrument {
-      private val charset = Charset.forName("UTF-8")
+      private val charset = StandardCharsets.UTF_8
       private val encoder = charset.newEncoder()
       private val decoder = charset.newDecoder()
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to