You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/09/26 22:27:03 UTC
DO NOT REPLY [Bug 36819] New: -
[configuration] Interpolation with multivalued keys returns nested strings instead of flattend string and interpolate doesn't work with all getters
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36819>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=36819
Summary: [configuration] Interpolation with multivalued keys
returns nested strings instead of flattend string and
interpolate doesn't work with all getters
Product: Commons
Version: 1.1 Final
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P2
Component: Configuration
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: mech@tngtech.com
CC: mech@tngtech.com
I tried these properties with Configuration 1.1 stable (a
PropertiesConfiguration in a CompositeConfiguration, but that shouldn't matter)
z=1,2,3,${x},7,8
x=4,${y}
y=5,6
If queried using getStringArray("z") etc. this results in:
e.g. something like
String[] z = config.getStringArray("z");
for (int i = 0; i < z.length; i++) {
System.out.println(z[i].toString());
}
1
2
3
[4, [5, 6]]
7
8
Note brackets and nesting!
I guess it would be better to flatten such multivalued keys without
brackets,commas and spaces e.g. the result should look like (note: this is
already formated a bit)
x = 4,5,6
y = 5,6
z = 1,2,3,4,5,6,7,8
Also note that commons-configuration-src-20050926.zip nightly build behaves
different, here the result was (also preformated):
x = [4, 5]
y = [5, 6]
z = [1, 2, 3, 4, 7, 8]
Looks as if only the first value is taken when interpolating...
---
Besides interpolate should get called for each getter.
a = ${b}
b = 5
One would expect config.getInt("a") == 5 instead of throwing an exception
because ${b} is no valid int. Of course, you can workaround by using
.getString("a") and converting manually, but this defeats the added value of all
different getters.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org