Skip to content

Commit

Permalink
finos#1296 add guard against .asInstanceOf inside TypeConverterContai…
Browse files Browse the repository at this point in the history
…ner.convert
  • Loading branch information
junaidzm13 committed Apr 25, 2024
1 parent 05e4b90 commit 3ea8671
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private case class TypeConverterContainerImpl(

override def convert[From, To](value: From, fromClass: Class[From], toClass: Class[To]): Option[To] = {
if (TypeUtils.areTypesEqual(fromClass, toClass)) {
return Some(value.asInstanceOf[To])
return Try(value.asInstanceOf[To]).toOption
}
typeConverter[From, To](fromClass, toClass).flatMap(tc => Try(tc.convert(value)).toOption)
}
Expand Down

0 comments on commit 3ea8671

Please sign in to comment.