Skip to content

Commit

Permalink
Merge pull request #290 from hveiga/move-clazz-instantiation-artery-d…
Browse files Browse the repository at this point in the history
…eserialization

Only instantiate clazz when includeManifest is enabled
  • Loading branch information
danischroeter committed Jul 14, 2023
2 parents c5b2ed2 + 2242b87 commit 722489d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ private[kryo] class KryoSerializerBackend(val kryo: Kryo, val bufferSize: Int, v
// Implements ByteBufferSerializer
override def fromBinary(buf: ByteBuffer, manifest: String): AnyRef = {
val buffer = getInput(buf)
val clazz = system.dynamicAccess.getClassFor[AnyRef](manifest)
if (includeManifest)
if (includeManifest) {
val clazz = system.dynamicAccess.getClassFor[AnyRef](manifest)
clazz match {
case Success(c) => kryo.readObject(buffer, c).asInstanceOf[AnyRef]
case _ => throw new RuntimeException("Object of unknown class cannot be deserialized")
}
else
} else
kryo.readClassAndObject(buffer)
}

Expand Down

0 comments on commit 722489d

Please sign in to comment.