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

Daniel Stoch updated WICKET-7155:
---------------------------------
    Affects Version/s: 9.19.0
                           (was: 9.21.0)

> 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.19.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)

Reply via email to