You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Chris (JIRA)" <ji...@apache.org> on 2019/02/05 09:54:00 UTC

[jira] [Updated] (CONFIGURATION-737) JupIOFactory and trimming of newline & carriage return characters

     [ https://issues.apache.org/jira/browse/CONFIGURATION-737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris updated CONFIGURATION-737:
--------------------------------
    Description: 
I want to configure the line separator that should be used in my output via config file.

E.g. using the property 

L1=\n

and JupIOFactory as following:
{quote}{{ public static Configuration loadConfig(String fileName) throws ConfigurationException {}}
{{Parameters params = new Parameters();}}

{{PropertiesBuilderParameters properties = params.properties();}}

{{properties.setFileName(fileName)}}
{{.setThrowExceptionOnMissing(true)}}
{{.setIOFactory(new PropertiesConfiguration.JupIOFactory())}}
{{.setListDelimiterHandler(new DefaultListDelimiterHandler(','));}}

{{FileBasedConfigurationBuilder<FileBasedConfiguration> builder =}}
{{new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)}}
{{.configure(properties}}
{{);}}
{{Configuration config = builder.getConfiguration();}}
{{return config;}}
{{}}}
{quote}
The value of the property gets trimmed. Java Properties (JDK 8) does not trim newline and carriage return characters.

 

The problem seems to arise in the method at the following code part (where the string is trimmed):
{quote}{{protected Collection<String> splitString(final String s, final boolean trim)}}

...

{{// Add last token}}
{{String t = token.toString();}}
{{if (trim)}}
{{{}}
{{t = t.trim();}}
{{}}}
{{list.add(t);}}
{quote}

  was:
I want to configure the line separator that should be used in my output via config file.

E.g. using the property 

L1=\n

and JupIOFactory as following:
{quote}{{public static Configuration loadConfig(String fileName) throws ConfigurationException {}}
{{ Parameters params = new Parameters();}}

{{ PropertiesBuilderParameters properties = params.properties();}}

{{ properties.setFileName(fileName)}}
{{ .setThrowExceptionOnMissing(true)}}
{{ .setIOFactory(new PropertiesConfiguration.JupIOFactory())}}
{{ .setListDelimiterHandler(new DefaultListDelimiterHandler(','));}}

{{ FileBasedConfigurationBuilder<FileBasedConfiguration> builder =}}
{{ new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)}}
{{ .configure(properties}}
{{ );}}
{{ Configuration config = builder.getConfiguration();}}
{{ return config;}}
{{ }}}
{quote}
The value of the property gets trimmed. Java Properties (JDK 8) does not trim newline and carriage return characters.

 

The problem seems to arise in the method at the following code part (DefaultListDelimiterHandler - where the string gets trimmed):
{quote}{{protected Collection<String> splitString(final String s, final boolean trim)}}

...

{{// Add last token}}
{{ String t = token.toString();}}
{{ if (trim)}}
{{ {}}
{{ t = t.trim();}}
{{ }}}
{{ list.add(t);}}
{quote}
 


> JupIOFactory and trimming of newline & carriage return characters
> -----------------------------------------------------------------
>
>                 Key: CONFIGURATION-737
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-737
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Expression engine
>    Affects Versions: 2.4
>            Reporter: Chris
>            Priority: Major
>
> I want to configure the line separator that should be used in my output via config file.
> E.g. using the property 
> L1=\n
> and JupIOFactory as following:
> {quote}{{ public static Configuration loadConfig(String fileName) throws ConfigurationException {}}
> {{Parameters params = new Parameters();}}
> {{PropertiesBuilderParameters properties = params.properties();}}
> {{properties.setFileName(fileName)}}
> {{.setThrowExceptionOnMissing(true)}}
> {{.setIOFactory(new PropertiesConfiguration.JupIOFactory())}}
> {{.setListDelimiterHandler(new DefaultListDelimiterHandler(','));}}
> {{FileBasedConfigurationBuilder<FileBasedConfiguration> builder =}}
> {{new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)}}
> {{.configure(properties}}
> {{);}}
> {{Configuration config = builder.getConfiguration();}}
> {{return config;}}
> {{}}}
> {quote}
> The value of the property gets trimmed. Java Properties (JDK 8) does not trim newline and carriage return characters.
>  
> The problem seems to arise in the method at the following code part (where the string is trimmed):
> {quote}{{protected Collection<String> splitString(final String s, final boolean trim)}}
> ...
> {{// Add last token}}
> {{String t = token.toString();}}
> {{if (trim)}}
> {{{}}
> {{t = t.trim();}}
> {{}}}
> {{list.add(t);}}
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)