commons-lang icon indicating copy to clipboard operation
commons-lang copied to clipboard

[LANG-1705] SerializationUtils.clone() throws a ClassCastException when override writeReplace()

Open a1batr0ss opened this issue 2 years ago • 2 comments

JIRA: https://issues.apache.org/jira/browse/LANG-1705

Due to the possibility that the serialized object type may be a different type after overriding writeReplace(), directly converting the serialized object to the original type(the type of parameter) will result in a ClassCastException.

Fix: Two templates are used for the return value and parameters of SerializationUtils.clone().

a1batr0ss avatar Sep 10 '23 13:09 a1batr0ss