From bca81b55ec955b4adb9876cf8043a0922443704d Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 6 Jul 2025 11:52:39 +0100 Subject: [PATCH] fix spelling of Algorithm (#1932) * fix spelling of Algorithm * Update JacksonSerializer.scala * Create pr-4682-rename-internal-algoritm-class.backwards.excludes * move file --- ...internal-algoritm-class.backwards.excludes | 22 +++++++++++++++++++ .../jackson/JacksonSerializer.scala | 14 ++++++------ 2 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 serialization-jackson/src/main/mima-filters/1.1.x.backwards.excludes/pr-4682-rename-internal-algoritm-class.backwards.excludes diff --git a/serialization-jackson/src/main/mima-filters/1.1.x.backwards.excludes/pr-4682-rename-internal-algoritm-class.backwards.excludes b/serialization-jackson/src/main/mima-filters/1.1.x.backwards.excludes/pr-4682-rename-internal-algoritm-class.backwards.excludes new file mode 100644 index 0000000000..a08f382f7c --- /dev/null +++ b/serialization-jackson/src/main/mima-filters/1.1.x.backwards.excludes/pr-4682-rename-internal-algoritm-class.backwards.excludes @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# PR4682 renames an internal class called Algoritm (a typo) +ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.serialization.jackson.Compression$Algoritm") +ProblemFilters.exclude[MissingTypesProblem]("org.apache.pekko.serialization.jackson.Compression$GZip") +ProblemFilters.exclude[MissingTypesProblem]("org.apache.pekko.serialization.jackson.Compression$LZ4") +ProblemFilters.exclude[MissingTypesProblem]("org.apache.pekko.serialization.jackson.Compression$Off$") diff --git a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala index c7761f1660..8781ac7489 100644 --- a/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala +++ b/serialization-jackson/src/main/scala/org/apache/pekko/serialization/jackson/JacksonSerializer.scala @@ -162,10 +162,10 @@ import pekko.util.OptionVal JacksonObjectMapperProvider(system).getOrCreate(bindingName, Some(new CBORFactory))) @InternalApi object Compression { - sealed trait Algoritm - object Off extends Algoritm - final case class GZip(largerThan: Long) extends Algoritm - final case class LZ4(largerThan: Long) extends Algoritm + sealed trait Algorithm + object Off extends Algorithm + final case class GZip(largerThan: Long) extends Algorithm + final case class LZ4(largerThan: Long) extends Algorithm } /** @@ -191,7 +191,7 @@ import pekko.util.OptionVal private val conf = JacksonObjectMapperProvider.configForBinding(bindingName, system.settings.config) private val isDebugEnabled = conf.getBoolean("verbose-debug-logging") && log.isDebugEnabled private final val BufferSize = 1024 * 4 - private val compressionAlgorithm: Compression.Algoritm = { + private val compressionAlgorithm: Compression.Algorithm = { toRootLowerCase(conf.getString("compression.algorithm")) match { case "off" => Compression.Off case "gzip" => @@ -298,7 +298,7 @@ import pekko.util.OptionVal result } - private def logToBinaryDuration(obj: AnyRef, startTime: Long, bytes: Array[Byte], result: Array[Byte]) = { + private def logToBinaryDuration(obj: AnyRef, startTime: Long, bytes: Array[Byte], result: Array[Byte]): Unit = { if (isDebugEnabled) { val durationMicros = (System.nanoTime - startTime) / 1000 if (bytes.length == result.length) @@ -395,7 +395,7 @@ import pekko.util.OptionVal bytes: Array[Byte], decompressBytes: Array[Byte], startTime: Long, - clazz: Class[_ <: AnyRef]) = { + clazz: Class[_ <: AnyRef]): Unit = { if (isDebugEnabled) { val durationMicros = (System.nanoTime - startTime) / 1000 if (bytes.length == decompressBytes.length)