You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by to...@quarendon.net on 2019/01/22 12:30:25 UTC

Apparent bug storing collection in org.apache.felix.utils.properties.TypedProperties

There appears to be a bug in org.apache.felix.utils.properties.TypedProperties to do with storing Lists. Or at least, it's behaving unexpectedly. Arrays are fine, it only applies to lists.
When writing a List out, it uses (). However in org.apache.felix.utils.properties.Properties.PropertiesReader there is logic to detect whether the value is "typed" or not. The regular expression *doesn't* allow for a value surrounded by (). So when reading the same file back in it doesn't think it's typed, so doesn't convert any of the values and leaves them all as strings. The effect is that if you save properties, and one of them is a list, on reading them back in, they are all returned as strings, complete with quotation marks, type characters etc.

This seems like a bug to me? I'm not very good with regex, but a simple modification to the regex in PropertiesReader.nextProperty would seem to solve it?

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Aw: Apparent bug storing collection in org.apache.felix.utils.properties.TypedProperties

Posted by wo...@gmx.de.
Hi Tom,

I can confirm your problem. Lists are not recognized as typed properties. The regular expression that is used in org.apache.felix.utils.properties.Properties.PropertiesReader is incomplete and cannot handle list types.

I have opened the following Jira issue:
https://issues.apache.org/jira/browse/FELIX-6042

I have fixed the issue and created a pull request, which can be found here:
https://github.com/apache/felix/pull/176

The pull request contains two small tests to make sure, that the issue does not reappear in future. I had to made some changes to the existing tests, because they failed on Windows platforms.

Thank you very much for your detailled problem analysis, that made it much easier to find a solution.

Regards,
Christoph


Gesendet: Dienstag, 22. Januar 2019 um 13:30 Uhr
Von: tom@quarendon.net
An: users@felix.apache.org
Betreff: Apparent bug storing collection in org.apache.felix.utils.properties.TypedProperties
There appears to be a bug in org.apache.felix.utils.properties.TypedProperties to do with storing Lists. Or at least, it's behaving unexpectedly. Arrays are fine, it only applies to lists.
When writing a List out, it uses (). However in org.apache.felix.utils.properties.Properties.PropertiesReader there is logic to detect whether the value is "typed" or not. The regular expression *doesn't* allow for a value surrounded by (). So when reading the same file back in it doesn't think it's typed, so doesn't convert any of the values and leaves them all as strings. The effect is that if you save properties, and one of them is a list, on reading them back in, they are all returned as strings, complete with quotation marks, type characters etc.

This seems like a bug to me? I'm not very good with regex, but a simple modification to the regex in PropertiesReader.nextProperty would seem to solve it?

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org