I wrote the code following the example on
http://commons.apache.org/configuration/userguide-1.2/howto_compositeconfiguration.html

There is no save() method in CompositeConfiguration. How can I save it?

Thanks.


On Wed, Jun 17, 2009 at 11:23 AM, Jörg Schaible <joerg.schai...@gmx.de>wrote:

> Alec Swan wrote at Mittwoch, 17. Juni 2009 18:39:
>
> > Thank you for updating the subject, Jörg.
> >
> > I changed the order in which I add defaults and overrides. The following
> > is the new code:
> >
> >                     // merge overrides with defaults
> >                     CompositeConfiguration compositeConfig = new
> > CompositeConfiguration(overridingConfig);
> >                     compositeConfig.addConfiguration(defaultConfig);
> >
> >                     // convert merged properties to string
> >                     StringWriter writer = new StringWriter();
> >                     overridingConfig.save(writer);
> >
> > defaultConfig contains the following properties:
> > # A property
> > A = 1
> > # B property
> > B = 2
> >
> > overridingConfig contains the following properties:
> > B = 3
> >
> > I expected the merged content written to the writer to contain these
> > properties:
> > # A property
> > A = 1
> > # B property
> > B = 3
> >
> > Instead, the merged content written to the writer is the same as the
> > overridingConfig:
> > B = 3
> >
> > Could anybody tell me what's wrong with my code?
>
> You saved the overridingConfiguration and not the compositeConfig.
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

Reply via email to