You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Mark Orciuch <mo...@apache.org> on 2002/12/20 23:15:20 UTC

[CONFIGURATION] Handling of non-string properties occuring multiple times

Currently the string based properties are handled as follows:

foo.bar = aaa
foo.bar = bbb

Configuration object returns "aaa" when using the following call:
getString("foo.bar"). However, in this scenario:

foo.bar = 1
foo.bar = 2

... calling getInt("foo.bar") will cause ClassCastException because multiple
instances of the same property are put in a Container object.

I propose that non-string properties (such as int, long, double, float,
byte) are handled the same way as strings. This is useful if you want to
keep the original property file intact and include it in a custom property
file:

site.properties:
================
...
services.TemplateService.layout.cache.size=20
...
include = TurbineResources.properties

TurbineResources.properties:
============================
...
services.TemplateService.layout.cache.size=10

In the above scenario, call to
getInt("services.TemplateService.layout.cache.size") should return 20 rather
than throw a ClassCastException. Attached patch implements my proposal.

Best regards,

Mark Orciuch - morciuch@apache.org
Jakarta Jetspeed - Enterprise Portal in Java
http://jakarta.apache.org/jetspeed/

Re: [CONFIGURATION] Handling of non-string properties occuring multiple times

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Mark Orciuch" <mo...@apache.org> writes:

>------=_NextPart_000_001E_01C2A842.FE5ED190
>Content-Type: text/plain;
>	charset="us-ascii"
>Content-Transfer-Encoding: 7bit

>Currently the string based properties are handled as follows:

>foo.bar = aaa
>foo.bar = bbb

>Configuration object returns "aaa" when using the following call:
>getString("foo.bar"). However, in this scenario:

>foo.bar = 1
>foo.bar = 2

>... calling getInt("foo.bar") will cause ClassCastException because multiple
>instances of the same property are put in a Container object.

Yep. However, the problem is, what happens if you have this

foo.bar = 1
foo.bar = xxx

Your patch is a possible solution. I will clean it up a little
and then commit to the repository. Thanks!

	Regards
		Henning
-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>