Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-241

clearProperty() does not generate events

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3
    • 1.4
    • None
    • None
    • Java 1.5, Windows XP

    Description

      I am loading configuration information from multiple sources and have registered a listener with the resulting configuration object. Unfortunately the listener does not receive "clear property" events. I've confirmed that it can properly receive other events (like "set property"), and that calls to "clearProperty()" do actually clear the property, so I believe this may be a bug in commons-configuration. I've tried setting "details" to true, which had no effect. Below is a watered down version of what I am doing (note, my configuration file simply pulls in a property file containing this property: name.first=Mike):

      ConfigurationFactory configurationFactory = new ConfigurationFactory();
      URL configFileURL = ... get the config file ...
      configurationFactory.setConfigurationURL(configFileURL);
      Configuration configuration = ConfigurationFactory.getConfiguration();

      configuration.addConfigurationListener(new ConfigurationListener() {

      public void configurationChanged(ConfigurationEvent e)

      { System.out.println(e.getPropertyName() + ": " + e.getPropertyValue()); }

      });

      System.out.println(configuration.getProperty("name.first")); // prints "Mike"
      configuration.claerProperty("name.first")); // no output whatsoever
      System.out.println(configuration.getProperty("name.first")); // prints "null"

      Attachments

        Activity

          People

            Unassigned Unassigned
            mikewhit Mike Whittemore
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: