[
https://issues.apache.org/jira/browse/LOG4J2-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Remko Popma closed LOG4J2-1663.
-------------------------------
Resolution: Fixed
Instead of serializing the values directly, I had to wrap them in a
{{MarshalledObject}} and serialize these instead. This is to deal with
situations where the class of the serialized object is not available during
deserialization.
If a ClassNotFoundException is encountered while deserializing one of the
values of the map, even if we catch this exception in the {{readObject}} method
of SortedArrayStringMap, the ObjectInputStream remembers the error and
re-throws it after reading all bytes for the map! ObjectInputStream has no
public API to clear this error. It is possible to use reflection to clear the
error but this is too fragile to be a realistic option.
Creating a MarshalledObject for each value is slightly inefficient but more
robust.
> Ensure SortedArrayStringMap can be serialized/deserialized regardless of
> content
> --------------------------------------------------------------------------------
>
> Key: LOG4J2-1663
> URL: https://issues.apache.org/jira/browse/LOG4J2-1663
> Project: Log4j 2
> Issue Type: Improvement
> Components: API
> Affects Versions: 2.7
> Reporter: Remko Popma
> Assignee: Remko Popma
> Fix For: 2.8
>
>
> Improve the implementation of SortedArrayStringMap serialization logic to
> ensure that serializing or deserializing it never results in an error,
> regardless of the content.
> * Values that are not Serializable should be replaced with {{null}} in the
> serialized form
> * When the class of a value is not available at the time the
> SortedArrayStringMap is deserialized, the value should be replaced with
> {{null}} in the deserialized object.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]