[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-user
Subject: Re: PropertiesConfiguration returning duplicate values from
From: Ralph Goers <ralph.goers () dslextreme ! com>
Date: 2010-03-30 6:00:23
Message-ID: B28832BB-7C48-49B5-BDC2-8635DAC8B357 () dslextreme ! com
[Download RAW message or body]
The constructor called load once because you specified the file name. From what I can from the code every time you call load you are going to get another set of the properties.
On Mar 29, 2010, at 2:56 PM, Allen, Justin wrote:
> Hi,
>
> I'm looking to get some insight on why I'm getting some unexpected
> output from the method getList() from the class PropertiesConfiguration
> as part of the commons-configuration-1.6 java lib.
>
> This line of code produces duplicate values in the returned list loaded
> from my applications property file:
>
> PropertiesConfiguration myAppProps= new
> PropertiesConfiguration(MY_APP_FILE);
> myAppProps.load();
> MyController ctrl = MyController.getInstance();
> ctrl.setAlertOnLamb(myAppProps.getBoolean("foo.fighter"));
> ctrl.setAlertOnRpe(myAppProps.getBoolean("bar.high"));
> ctrl.setMyBazNamesList(myAppProps.getList("baz.names"));
>
> System.out.println("This is the baz list: " +
> myAppProps.getList("baz.names"));
>
>
> Application Output is:
>
> This is the baz list: [larry, curly, moe, larry, curly, moe]
>
>
> This is the underlying property file which is loaded by the
> PropertiesConfiguration class:
>
> #############################################################
> # Properties Configuration File for myApp
> #############################################################
>
> #Set this value for foo
> foo.fighter = false
>
> #Set this value for bar
> bar.high = false
>
> #List of baz names
> baz.names = larry, curly, moe
>
>
>
> Any reason why this would produce a list with duplicate entries? This
> doesn't appear to be normal behavior according to the documentation on
> this class. Let me know if there is any more information I can provide
> to clarify this bug, I'm getting.
>
> Thanks for looking into this,
>
> Justin Allen
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic