You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Paul Spencer (Jira)" <ji...@apache.org> on 2022/05/16 19:00:00 UTC

[jira] [Updated] (KARAF-7435) Setting a configuration parameter to null throws an NPE.

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

Paul Spencer updated KARAF-7435:
--------------------------------
    Description: 
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

}

  was:
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
}


> Setting a configuration parameter to null throws an NPE.
> --------------------------------------------------------
>
>                 Key: KARAF-7435
>                 URL: https://issues.apache.org/jira/browse/KARAF-7435
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf
>    Affects Versions: 4.3.6
>            Reporter: Paul Spencer
>            Priority: Major
>
> 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
> }



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