commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alec Swan <>
Subject Merging overrides with defaults
Date Tue, 16 Jun 2009 21:51:55 GMT
I have a property file containing default configurations in a key=value
format. I also have another file with the same format which contains
overrides for some of the properties. I need to apply the overrides to the
default configuration while preserving the format and comments. I also need
to write the merged content to a string.

I am using the following code, but the mergedContent contains the default
content and no overrides. I tried reversing the order in which I add
defaultConfig and overridingConfig to CompositeConfiguration, but still no

            PropertiesConfiguration mergedConfig = new
            CompositeConfiguration compositeConfig = new
            mergedConfig = defaultConfig;


            StringWriter writer = new StringWriter();
            String mergedContent = writer.toString();

What's wrong with the code above?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message