Karaf 4.3.6
Setting a configuration parameter to null throws a NullPointerException.  The 
specification, 
https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html, 
is silent on the use of null as a property value, but includes the following 
"If a requested conversion cannot be performed, then the configuration is not 
processed and the Configurator implementation should log an error."; in 
addition the configuration parameter are stored in a Dictionary structure which 
requires a non-null key and non-null value.

Although the json format supports 'null' as value and OSGi confutation appears 
to required non-null values, should Karaf log something like "Null value for 
<Property Name> not supported." instead of throwing a NPE?

***
* Thrown exception
***

java.lang.NullPointerException: null
        at 
org.apache.karaf.config.core.impl.JsonConfigInstaller.setConfig(JsonConfigInstaller.java:87)
 ~[?:?]
        at 
org.apache.karaf.config.core.impl.JsonConfigInstaller.update(JsonConfigInstaller.java:66)
 ~[?:?]
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.update(DirectoryWatcher.java:1117)
 [!/:3.7.4]
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.update(DirectoryWatcher.java:919)
 [!/:3.7.4]
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:488)
 [!/:3.7.4]
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
 [!/:3.7.4]
        at 
org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
 [!/:3.7.4]


***
* etc/foo.json
***
{
   "myNullValue":null
}

Paul Spencer

Reply via email to