You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "John Meagher (JIRA)" <ji...@apache.org> on 2007/05/22 22:15:17 UTC

[jira] Created: (CONFIGURATION-272) ConfigurationUtils.copy results in escaped "," characters no longer being escaped

ConfigurationUtils.copy results in escaped "," characters no longer being escaped
---------------------------------------------------------------------------------

                 Key: CONFIGURATION-272
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-272
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.4
         Environment: commons 1.4
            Reporter: John Meagher


When using ConfigurationUtils.copy to go between configuration formats any escaped out "," characters are put into the output configuration without the escape character.  This results in a different value being returned from getString calls as it now things the property is a list.  If 4 escape characters are used instead of the expected 1 then the copy will end up with the correct value, but then the original will end up with the escape character as part of the property value.  

Example:
SomeLongProperty=This is a test\, it is only a test
# Ends up right in the copy, but not right in the original
SomeOtherProperty=This is also a test\\\\, it is also only a test

After copy:
# Missing "\" before ","
SomeLongProperty=This is a test, it is only a test
SomeOtherProperty=This is also a test\, it is also only a test


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-272) ConfigurationUtils.copy results in escaped "," characters no longer being escaped

Posted by "John Meagher (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12498213 ] 

John Meagher commented on CONFIGURATION-272:
--------------------------------------------

With that workaround it works as expected.  

> ConfigurationUtils.copy results in escaped "," characters no longer being escaped
> ---------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-272
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-272
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: commons 1.4
>            Reporter: John Meagher
>             Fix For: 1.5
>
>
> When using ConfigurationUtils.copy to go between configuration formats any escaped out "," characters are put into the output configuration without the escape character.  This results in a different value being returned from getString calls as it now things the property is a list.  If 4 escape characters are used instead of the expected 1 then the copy will end up with the correct value, but then the original will end up with the escape character as part of the property value.  
> Example:
> SomeLongProperty=This is a test\, it is only a test
> # Ends up right in the copy, but not right in the original
> SomeOtherProperty=This is also a test\\\\, it is also only a test
> After copy:
> # Missing "\" before ","
> SomeLongProperty=This is a test, it is only a test
> SomeOtherProperty=This is also a test\, it is also only a test

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-272) ConfigurationUtils.copy results in escaped "," characters no longer being escaped

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12510904 ] 

Oliver Heger commented on CONFIGURATION-272:
--------------------------------------------

I think the problem here is that ConfigurationUtils operates on plain Configuration objects and does not know about specifics like list delimiters available only for classes derived from AbstractConfiguration. And performing a cast to AbstractConfiguration in these methods would be really ugly IMO.

A solution would be to add new copy() and append() methods to AbstractConfiguration with the same semantics. Then we had full control over the copy process and could also determine, which events to generate (maybe it does not make sense to trigger an event for each copied property, but only one event for the whole copy operation).

copy() and append() in ConfigurationUtils could then be deprecated, or at least a remark could be added to their documentation that the variants implemented by AbstractConfiguration are preferable.

> ConfigurationUtils.copy results in escaped "," characters no longer being escaped
> ---------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-272
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-272
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: commons 1.4
>            Reporter: John Meagher
>            Assignee: Emmanuel Bourg
>             Fix For: 1.5
>
>
> When using ConfigurationUtils.copy to go between configuration formats any escaped out "," characters are put into the output configuration without the escape character.  This results in a different value being returned from getString calls as it now things the property is a list.  If 4 escape characters are used instead of the expected 1 then the copy will end up with the correct value, but then the original will end up with the escape character as part of the property value.  
> Example:
> SomeLongProperty=This is a test\, it is only a test
> # Ends up right in the copy, but not right in the original
> SomeOtherProperty=This is also a test\\\\, it is also only a test
> After copy:
> # Missing "\" before ","
> SomeLongProperty=This is a test, it is only a test
> SomeOtherProperty=This is also a test\, it is also only a test

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-272) ConfigurationUtils.copy results in escaped "," characters no longer being escaped

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12497999 ] 

Emmanuel Bourg commented on CONFIGURATION-272:
----------------------------------------------

ConfigurationUtils.copy() calls setProperty on the target configuration with the value returned from getProperty() on the source configuration. The target configuration performs a new value parsing but it should not. A workaround is to disable the parsing of the delimiter before copying, and restore it after the copy :

target.setDelimiterParsingDisabled(true);
ConfigurationUtils.copy(source, target);
target.setDelimiterParsingDisabled(false);

> ConfigurationUtils.copy results in escaped "," characters no longer being escaped
> ---------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-272
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-272
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: commons 1.4
>            Reporter: John Meagher
>             Fix For: 1.5
>
>
> When using ConfigurationUtils.copy to go between configuration formats any escaped out "," characters are put into the output configuration without the escape character.  This results in a different value being returned from getString calls as it now things the property is a list.  If 4 escape characters are used instead of the expected 1 then the copy will end up with the correct value, but then the original will end up with the escape character as part of the property value.  
> Example:
> SomeLongProperty=This is a test\, it is only a test
> # Ends up right in the copy, but not right in the original
> SomeOtherProperty=This is also a test\\\\, it is also only a test
> After copy:
> # Missing "\" before ","
> SomeLongProperty=This is a test, it is only a test
> SomeOtherProperty=This is also a test\, it is also only a test

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (CONFIGURATION-272) ConfigurationUtils.copy results in escaped "," characters no longer being escaped

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499126 ] 

Emmanuel Bourg commented on CONFIGURATION-272:
----------------------------------------------

The append() function is also affected by this issue.

I have two solutions in mind :

- Implement the workaround mentioned above in the copy and append functions, but this is not thread safe, if the target configuration is saved at this moment the list delimiters are lost. It's certain to happen if the target configuration is a file configuration with auto save set to true.

- for copy(), use clearProperty + addPropertyDirect. Unfortunately this will trigger 2 events per key, and since fireEvent() is protected it's not possible to use the setDetail() trick to fire the right event.

> ConfigurationUtils.copy results in escaped "," characters no longer being escaped
> ---------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-272
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-272
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: commons 1.4
>            Reporter: John Meagher
>         Assigned To: Emmanuel Bourg
>             Fix For: 1.5
>
>
> When using ConfigurationUtils.copy to go between configuration formats any escaped out "," characters are put into the output configuration without the escape character.  This results in a different value being returned from getString calls as it now things the property is a list.  If 4 escape characters are used instead of the expected 1 then the copy will end up with the correct value, but then the original will end up with the escape character as part of the property value.  
> Example:
> SomeLongProperty=This is a test\, it is only a test
> # Ends up right in the copy, but not right in the original
> SomeOtherProperty=This is also a test\\\\, it is also only a test
> After copy:
> # Missing "\" before ","
> SomeLongProperty=This is a test, it is only a test
> SomeOtherProperty=This is also a test\, it is also only a test

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (CONFIGURATION-272) ConfigurationUtils.copy results in escaped "," characters no longer being escaped

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-272?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bourg updated CONFIGURATION-272:
-----------------------------------------

    Fix Version/s: 1.5

> ConfigurationUtils.copy results in escaped "," characters no longer being escaped
> ---------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-272
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-272
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: commons 1.4
>            Reporter: John Meagher
>             Fix For: 1.5
>
>
> When using ConfigurationUtils.copy to go between configuration formats any escaped out "," characters are put into the output configuration without the escape character.  This results in a different value being returned from getString calls as it now things the property is a list.  If 4 escape characters are used instead of the expected 1 then the copy will end up with the correct value, but then the original will end up with the escape character as part of the property value.  
> Example:
> SomeLongProperty=This is a test\, it is only a test
> # Ends up right in the copy, but not right in the original
> SomeOtherProperty=This is also a test\\\\, it is also only a test
> After copy:
> # Missing "\" before ","
> SomeLongProperty=This is a test, it is only a test
> SomeOtherProperty=This is also a test\, it is also only a test

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org