Wednesday, May 7, 2014

apache commons PropertiesConfiguration does NOT disable delimiters


Hi all, I am trying to disable comma delimiter in order to retrieve queries from my properties files.

Below is my code:



Java Code:



AbstractConfiguration.setDefaultListDelimiter('0');
PropertiesConfiguration queriesProperties = new PropertiesConfiguration("queries.properties");
queriesProperties.setDelimiterParsingDisabled(true);
queriesProperties.setListDelimiter('0');

logger.debug("queriesProperties.isDelimiterParsingDisabled(): " + queriesProperties.isDelimiterParsingDisabled()); // logs "TRUE"
logger.debug("queriesProperties.getListDelimiter(): " + queriesProperties.getListDelimiter()); // logs "0"

String query = queriesProperties.getString("queryKey");
logger.debug("QUERY: " + query);

And what I get logged from my properties file is only the following:

but below is what I have in my queries.properties


Java Code:



queryKey=select a,b,c,d from table_a

Why is the PropertiesConfiguration still splitting my property values by comma even if I tried to disable this functionality?

Thank you all in advance for any help.



No comments:

Post a Comment