Skip to content

Commit

Permalink
Only instantiate clazz when includeManifest is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
hveiga authored and Héctor Veiga Ortiz committed Jul 14, 2023
1 parent c5b2ed2 commit 2242b87
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 2242b87

Please sign in to comment.