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: [email protected]
For additional commands, e-mail: [email protected]