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

The conversion handler is not inherited by children

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.1, 2.6
    • None
    • Type conversion
    • None
    • Package: commons-configuration2-2.6.jar (from maven central), apache-commons-configuration2-2.1-6.fc30.noarch (from Fedora repo).

      JVM and Java compiler: java-11-openjdk-11.0.6.10-0.fc31.x86_64 (from Fedora repo). 

      OS: Fedora 31

    Description

      If a setting is requested from a configuration with a custom converter, the custom converter will be invoked for all conversions as expected, even if the key points to an element in a INI section/XML child element, etcetera.

      If the INI section or XML child element is requested using the ImmutableHierarchicalConfiguration.immutableConfigurationAt() or a similar method and the property is requested from the child configuration, then the DefaultConversionHandler is used to perform the conversion.

      The attached source demonstrates this behaviour: the last get() causes a ConversionException instead of returning the requested Duration.

      I noticed that the conversion handler is not copied in BaseHierarchicalConfiguration.initSubConfiguration(). It should probably be added there, but I do not know if there are more locations were the conversion handler should be copied as well.

       

       

       

      Attachments

        1. Main.java
          2 kB
          Martin den Heijer

        Activity

          People

            Unassigned Unassigned
            heijerm@xs4all.nl Martin den Heijer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: