You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Duc Tran <dt...@linagora.com> on 2019/09/03 10:14:05 UTC

Re: commons-configurations2 doesn't strip double quotes in env variable

Hello Oliver, I tried out your solution and I can see the 
`properties.getArrayString()` now works. But `properties.getList()` 
still doesn't. I looked at the `getList()` implementation at 
`AbstractConfiguration` and don't see it uses the conversionHandler. I 
have to keep my work around by declaring a new DecoratorProperties and 
strips double quote in `getArrayString()` and `getList()`.

Do you want me to create an JIRA issue about it?

Thank you!

Duc,


   From looking in the code, the problem seems to be in the
   DefaultConversionHandler class, which is eventually invoked to convert a
   value into an array or a collection. In the protected extractValues()
   method a DisabledListDelimiterHandler is used to process the value -
   which of course does not handle the delimiter character. To be honest, I
   don't know why it was implemented that way; this could be considered a bug.

   A work-around could be to implement a custom ConversionHandler that
   extends DefaultConversionHandler. Here you can override the
   extractValues() method, and if the value is a String, you can delegate
   to the split() method of a DefaultListDelimiterHandler.