[
https://issues.apache.org/jira/browse/SLING-5914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15399289#comment-15399289
]
Carsten Ziegeler commented on SLING-5914:
-----------------------------------------
I have more and more the feeling that we should not fix this problem - we
started by using an internal implementation class of the configuration admin
implementation - which looked ok back then. It is still ok for 99% of the use
cases, only float and double are problematic. As the usage of these is usually
not really common, I suggest we simply document the behaviour and leave it as
is. Creating a common module and creating a net of dependencies just for this
minor use case, is not a good idea imho.
I think we should rather support the YAML based format for configurations
defined as part of RFC 218
(https://github.com/osgi/design/blob/master/rfcs/rfc0218/rfc-0218-Configurator.pdf).
This way we have a) a format that supports all types and b) use a specified
format instead of our home brewn one.
> Provisioning model does not correctly handle floating-point configuration
> values
> --------------------------------------------------------------------------------
>
> Key: SLING-5914
> URL: https://issues.apache.org/jira/browse/SLING-5914
> Project: Sling
> Issue Type: Bug
> Components: Tooling
> Reporter: Robert Munteanu
> Fix For: Sling Provisioning Model 1.4.6
>
>
> The provisioning model specifies that floating-point values are encoded in
> the following format:
> - {{D"1.0"}} for doubles
> - {{F"1.0"}} for floats
> However, the ConfigAdmin has a different idea about how these values should
> be stored:
> {code:java}
> case TOKEN_SIMPLE_FLOAT:
> case TOKEN_PRIMITIVE_FLOAT:
> int fBits = Integer.parseInt( readQuoted( pr ) );
> return new Float( Float.intBitsToFloat( fBits ) );
> case TOKEN_SIMPLE_DOUBLE:
> case TOKEN_PRIMITIVE_DOUBLE:
> long dBits = Long.parseLong( readQuoted( pr ) );
> return new Double( Double.longBitsToDouble( dBits ) );
> {code}
> I assume that this is done to preserve precision when reading/writing values.
> The provisioning model should be updated to mediate between the user-supplied
> values and the configuration admin format.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)