You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Emily Berk (JIRA)" <ji...@apache.org> on 2017/08/17 18:53:00 UTC

[jira] [Commented] (FELIX-5306) Fileinstall can't read floats and doubles in .config files

    [ https://issues.apache.org/jira/browse/FELIX-5306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16131002#comment-16131002 ] 

Emily Berk commented on FELIX-5306:
-----------------------------------

I encountered this issue as well for {{org.apache.felix.fileinstall}} 3.6.0.

For {{myfloatProperty=F"10.5"}}, I get
{code}
Failed to install artifact: myService.config
java.lang.NumberFormatException: For input string: "10.5"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:?]
	at java.lang.Integer.parseInt(Integer.java:580) [?:?]
	at java.lang.Integer.parseInt(Integer.java:615) [?:?]
	at org.apache.felix.utils.properties.ConfigurationHandler.readSimple(ConfigurationHandler.java:482) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.utils.properties.ConfigurationHandler.readValue(ConfigurationHandler.java:369) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.utils.properties.ConfigurationHandler.read(ConfigurationHandler.java:281) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.utils.properties.TypedProperties.convertFromString(TypedProperties.java:353) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.utils.properties.TypedProperties.get(TypedProperties.java:180) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.fileinstall.internal.ConfigInstaller.setConfig(ConfigInstaller.java:244) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.fileinstall.internal.ConfigInstaller.install(ConfigInstaller.java:78) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:937) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:871) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:485) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361) [8:org.apache.felix.fileinstall:3.6.0]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312) [8:org.apache.felix.fileinstall:3.6.0]
{code}


I didn't have luck trying other variations:
{{myfloatProperty==f"10.5"}}
{{myfloatProperty=F10.5}}
{{myfloatProperty=f10.5}}
{{myfloatProperty=F"0x41280000"}} (IEEE 757 format)
{{myfloatProperty=f"0x41280000"}}
{{myfloatProperty=F0x41280000}}
{{myfloatProperty=f0x41280000}}

Documentation should be updated to explain the syntax for floats and doubles.

> Fileinstall can't read floats and doubles in .config files 
> -----------------------------------------------------------
>
>                 Key: FELIX-5306
>                 URL: https://issues.apache.org/jira/browse/FELIX-5306
>             Project: Felix
>          Issue Type: Bug
>          Components: File Install
>            Reporter: munene kiruja
>
> The format for specifying a float in the .config format is <key>=F"<float value> and similarly for doubles but with the type character D.
> When the floats and doubles are encountered in the config, java.lang.NumberFormatException is thrown with the message like:
> {code}
> java.lang.NumberFormatException: For input string: "400.333"
> 	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> 	at java.lang.Integer.parseInt(Integer.java:580)
> 	at java.lang.Integer.parseInt(Integer.java:615)
> {code} 
> The code is actually parsing using Integer and Long classes!! 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)