[jira] [Comment Edited] (CONFIGURATION-26) Consider returning a concatenation of the list properties with getString()

2012-08-16 Thread Baris Acar (JIRA)

[ 
https://issues.apache.org/jira/browse/CONFIGURATION-26?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13435884#comment-13435884
 ] 

Baris Acar edited comment on CONFIGURATION-26 at 8/16/12 9:19 PM:
--

Last updates on this issue were in 2007 - did anything happen?

I would argue that {{getString()}} should return the value from the property 
file _verbatim_ - not the first item in the list, but not concatenated either - 
I'm concerned concatenation could end up slightly changing the format, using 
the wrong delimiter, etc. (Ittay's suggestion of returning the string 
representation of a List is somewhat ambiguous - does he/she mean 
{{List.toString()}}? This may not be what's wanted).

What is the use case for having {{getString}} return the first item of a list 
anyway? I have to say as a newcomer to commons config, this is _very_ 
unexpected behaviour. If someone wants the first item of a list, surely they 
_know_ that and can just request {{config.getStringArray(foo)\[0\]}}, which 
is clear and explicit.

As it stands I don't appear to have a way to parse the following config 
meaningfully:
{code}
foo=hello, world! 
bar=first,second 
{code}
with foo as a string (hello, world!) and bar as a list ({first, second}).



  was (Author: bacar):
Last updates on this issue were in 2007 - did anything happen?

I would argue that {{getString()}} should return the value from the property 
file _verbatim_ - not the first item in the list, but not concatenated either - 
I'm concerned concatenation could end up slightly changing the format, using 
the wrong delimiter, etc. (Ittay's suggestion of returning the string 
representation of a List is somewhat ambiguous - does he/she mean 
{{List.toString()}}? This may not be what's wanted).

What is the use case for having {{getString}} return the first item of a list 
anyway? I have to say as a newcomer to commons config, this is _very_ 
unexpected behaviour. If someone wants the first item of a list, surely they 
_know_ that and can just request {{config.getStringArray(foo)[0]}}, which is 
clear and explicit.

As it stands I don't appear to have a way to parse the following config 
meaningfully:
{code}
foo=hello, world! 
bar=first,second 
{code}
with foo as a string (hello, world!) and bar as a list ({first, second}).


  
 Consider returning a concatenation of the list properties with getString()
 --

 Key: CONFIGURATION-26
 URL: https://issues.apache.org/jira/browse/CONFIGURATION-26
 Project: Commons Configuration
  Issue Type: Bug
Reporter: Ittay Dror
Priority: Minor
 Fix For: 2.0


 in AbstractConfiguration.resolveContainerStore (javadoc):
   * Returns an object from the store described by the key. If the value is a
   * List object, replace it with the first object in the list.
 but what if getProperty returns a List because this is the type of the 
 property? 
  this code will silently grab the first elemen. I don't understand why. 
 Probably 
 the reason is that some class extending AbstractConfiguration returns List 
 for 
 properties. In this case I think the better approach is to have that class 
 return the first element instead, rather than returning the List and letting 
 AbstractConfiguration (which is used by many other implementations, including 
 outside of the configuration package) handle it

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Comment Edited] (CONFIGURATION-26) Consider returning a concatenation of the list properties with getString()

2012-08-16 Thread Baris Acar (JIRA)

[ 
https://issues.apache.org/jira/browse/CONFIGURATION-26?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13435884#comment-13435884
 ] 

Baris Acar edited comment on CONFIGURATION-26 at 8/16/12 9:19 PM:
--

Last updates on this issue were in 2007 - did anything happen?

I would argue that {{getString()}} should return the value from the property 
file _verbatim_ - not the first item in the list, but not concatenated either - 
I'm concerned concatenation could end up slightly changing the format, using 
the wrong delimiter, etc. (Ittay's suggestion of returning the string 
representation of a List is somewhat ambiguous - does he/she mean 
{{List.toString()}}? This may not be what's wanted).

What is the use case for having {{getString}} return the first item of a list 
anyway? I have to say as a newcomer to commons config, this is _very_ 
unexpected behaviour. If someone wants the first item of a list, surely they 
_know_ that and can just request {{config.getStringArray(foo)\[0\]}}, which 
is clear and explicit.

As it stands I don't appear to have a way to parse the following config 
meaningfully:
{code}
foo=hello, world! 
bar=first,second 
{code}
with foo as a string (hello, world!) and bar as a list ({first, second}).

I recently asked about how to do this on SO 
http://stackoverflow.com/questions/11973773/can-i-use-both-arrays-and-non-arrays-with-apache-commons-config

  was (Author: bacar):
Last updates on this issue were in 2007 - did anything happen?

I would argue that {{getString()}} should return the value from the property 
file _verbatim_ - not the first item in the list, but not concatenated either - 
I'm concerned concatenation could end up slightly changing the format, using 
the wrong delimiter, etc. (Ittay's suggestion of returning the string 
representation of a List is somewhat ambiguous - does he/she mean 
{{List.toString()}}? This may not be what's wanted).

What is the use case for having {{getString}} return the first item of a list 
anyway? I have to say as a newcomer to commons config, this is _very_ 
unexpected behaviour. If someone wants the first item of a list, surely they 
_know_ that and can just request {{config.getStringArray(foo)\[0\]}}, which 
is clear and explicit.

As it stands I don't appear to have a way to parse the following config 
meaningfully:
{code}
foo=hello, world! 
bar=first,second 
{code}
with foo as a string (hello, world!) and bar as a list ({first, second}).


  
 Consider returning a concatenation of the list properties with getString()
 --

 Key: CONFIGURATION-26
 URL: https://issues.apache.org/jira/browse/CONFIGURATION-26
 Project: Commons Configuration
  Issue Type: Bug
Reporter: Ittay Dror
Priority: Minor
 Fix For: 2.0


 in AbstractConfiguration.resolveContainerStore (javadoc):
   * Returns an object from the store described by the key. If the value is a
   * List object, replace it with the first object in the list.
 but what if getProperty returns a List because this is the type of the 
 property? 
  this code will silently grab the first elemen. I don't understand why. 
 Probably 
 the reason is that some class extending AbstractConfiguration returns List 
 for 
 properties. In this case I think the better approach is to have that class 
 return the first element instead, rather than returning the List and letting 
 AbstractConfiguration (which is used by many other implementations, including 
 outside of the configuration package) handle it

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira