Commons Configuration
  1. Commons Configuration
  2. CONFIGURATION-117

[configuration] MapConfiguration doesn't support multiple-valued properties

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      The MapConfiguration addPropertyDirect method does not support multiple-valued properties. The following implementation is what I used to fix the problem.

      protected void addPropertyDirect(String key, Object obj) {
      Object currentValue = getProperty(key);
      if (currentValue == null)

      { getMap().put(key, obj); }

      else if (List.class.isAssignableFrom(currentValue.getClass()))

      { ((List) currentValue).add(obj); }

      else

      { List values = new ArrayList(); values.add(currentValue); values.add(obj); getMap().put(key, values); }

      }

        Activity

        Steve Bate created issue -
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 35945 12342418
        Henri Yandell made changes -
        Affects Version/s 1.1 Final [ 12311652 ]
        Key COM-2266 CONFIGURATION-117
        Project Commons [ 12310458 ] Commons Configuration [ 12310467 ]
        Component/s Configuration [ 12311107 ]
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Henri Yandell made changes -
        Affects Version/s 1.1 Final [ 12311695 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Steve Bate
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development