You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Tzvetanov Grigorov (Jira)" <ji...@apache.org> on 2025/06/03 11:21:00 UTC

[jira] [Assigned] (WICKET-7155) Cannot clear Application metadata - NullPointerException

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

Martin Tzvetanov Grigorov reassigned WICKET-7155:
-------------------------------------------------

    Assignee: Martijn Dashorst

> Cannot clear Application metadata - NullPointerException
> --------------------------------------------------------
>
>                 Key: WICKET-7155
>                 URL: https://issues.apache.org/jira/browse/WICKET-7155
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 9.21.0
>            Reporter: Daniel Stoch
>            Assignee: Martijn Dashorst
>            Priority: Major
>
> After change in WICKET-7002 now it is not possible to clear value stored in Application under MetaDataKey.
> For now the call:
> {code}
> application.setMetaData(KEY, null)
> {code}
> raises an exception:
> {noformat}
> java.lang.NullPointerException
> 	at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
> 	at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
> 	at org.apache.wicket.Application.setMetaData(Application.java:515)
> ...
> {noformat}
> Maybe this method should be implemented like:
> {code}
> 	public final <T> Application setMetaData(final MetaDataKey<T> key, final T object)
> 	{
> 		if (object != null) 
> 			metaData.put(key, object);
> 		else
> 			metaData.remove(key);
> 		return this;
> 	}
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)