[ 
https://issues.apache.org/jira/browse/ISIS-3013?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andi Huber closed ISIS-3013.
----------------------------

> [Wicket Viewer] ComponentHintKey can cause NPE
> ----------------------------------------------
>
>                 Key: ISIS-3013
>                 URL: https://issues.apache.org/jira/browse/ISIS-3013
>             Project: Isis
>          Issue Type: Bug
>          Components: Wicket Viewer
>    Affects Versions: 2.0.0-M7
>            Reporter: Miklós Győrfi
>            Assignee: Andi Huber
>            Priority: Major
>             Fix For: 2.0.0-RC1
>
>
> There is two method to access key value in ComponentHintKey  according to the 
> getKey() method: accessing the component directly if exists, or the 
> componentProvider.  But componentProvider is transient: after the 
> serialization/deserialization cycle it can not be accessed, causing 
> NullPointerException in getKey(). (Wicket viewer caches the page, so 
> serialization is a must)
> Solution: gain access to the component directly on serialization:
>  
> {code:java}
> private void writeObject(ObjectOutputStream oos)
>         throws IOException {
>     if (componentProvider != null && component == null) {
>         try {
>             component = componentProvider.get();
>         } catch (Exception ignored) {
> // Maybe some log is necessary or throw the error
>         }
>     }
>     oos.defaultWriteObject();
> } {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to