We've been using the OSGi configuration mechanism in our Sling application for
about four months without any problems. Suddenly we ran into an issue on a test
machine today... the configuration file was missing data types. For example, an
entry that should look like
com.idexx.imaging.imagemanager.retryTimes=I"5"
now looks like
com.idexx.imaging.imagemanager.retryTimes="5"
In other words, the parameter mysteriously became a String. The code that
parsed this configuration, i.e. the method
@Activate
@Modified
public void configure(final Map<String, Object> props)
did not handle this properly and needed to be fixed. I've made that fix, but
I'm still baffled as to how this happened and why we never saw this in four
months of diligent testing. I dug into Felix a bit and found that the code that
writes these files [1] *always* writes the data type, *unless* that type
happens to be String. So it seems that whatever called Felix in order to write
the configuration decided to change all of the types to String. I'm at a loss
to explain this. I am unable to reproduce this by changing values through the
Sling Configuration console. Does anyone have any idea what might be happening
here? Thanks!
[1]
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.felix/org.apache.felix.configadmin/1.6.0/org/apache/felix/cm/file/ConfigurationHandler.java#ConfigurationHandler.writeType%28java.io.Writer%2Cjava.lang.Class%29