You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Miklós Győrfi (Jira)" <ji...@apache.org> on 2022/04/22 07:55:00 UTC
[jira] [Created] (ISIS-3013) ComponentHintKey can cause NPE
Miklós Győrfi created ISIS-3013:
-----------------------------------
Summary: 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
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)