use StandardCharsets (#934)
This commit is contained in:
parent
2ae6c8d00c
commit
6883d15576
5 changed files with 12 additions and 12 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue