freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Poruchikov (Jira)" <>
Subject [jira] [Commented] (FREEMARKER-119) TemplateException throws NPE after deserialization
Date Sun, 06 Oct 2019 15:43:00 GMT


Alex Poruchikov commented on FREEMARKER-119:

Hessian (Burlap) has two ways to add custom (De)Serializer.
First - via {{}} instance, e.g. {{hessianInput.getSerializerFactory().addFactory(...)}}.
It is not suitable for this case.
Second - via so called "Context (De)Serializer", see {{
c)}}, it uses reflection to instantiate deserializer class by name.
Deserializer class should be in the same package as the class that should be deserialized,
and should have name like {{MyClassHessianDeserializer}} (for class {{MyClass}}).
This approach does not handle inheritance hierachy at all. And, because too many descendants
of {{freemarker.template.TemplateException}} exists, it is, probably, unusable in this case
But, from the other hand, these deserializers may be placed in the separate jar.

See attachments for working example of such custom deserializer for {{InvalidReferenceException}}.




> TemplateException throws NPE after deserialization
> --------------------------------------------------
>                 Key: FREEMARKER-119
>                 URL:
>             Project: Apache Freemarker
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 2.3.27-incubating, 2.3.29
>            Reporter: Alex Poruchikov
>            Priority: Major
>         Attachments:,,
> freemarker.template.TemplateException cannot be deserealized properly, because of transient
field "lock", used in getMessage() method. See line 441 in
> It throws NPE when getMessage() method is called on deserialized object.
> Problem appears, at least, with Hessian and Burlap serialization protocols from

This message was sent by Atlassian Jira

View raw message