Commons Configuration
  1. Commons Configuration
  2. CONFIGURATION-25

[configuration] ClassCastException in XMLConfiguration

    Details

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

      Operating System: other
      Platform: All

      Description

      In the XMLConfigurations addXMLProperty, it takes an Object as the value to set:
      Element child = document.createElement(nodes[nodes.length - 1]);
      parent.appendChild(child);
      if (attName == null)

      { CharacterData data = document.createTextNode((String) value); child.appendChild(data); } else { child.setAttribute(attName, (String) value); }
      This should be changed to :
      Element child = document.createElement(nodes[nodes.length - 1]);
      parent.appendChild(child);
      if (attName == null) { CharacterData data = document.createTextNode((String) value); child.appendChild(data); }

      else

      { child.setAttribute(attName, value.toString); }

      Thereby avoiding a potential ClasscastException.
      Since I can't get at the CVS, I am submitting the change this way.

      Hermod

        Activity

        Hermod Opstvedt created issue -
        Hide
        Hermod Opstvedt added a comment -

        That should of course be : Element child = document.
        createElement(nodes[nodes.length - 1]);
        parent.appendChild(child);
        if (attName == null)

        { CharacterData data = document.createTextNode(value.toString()); child.appendChild(data); }

        else

        { child.setAttribute(attName, value.toString); }
        Show
        Hermod Opstvedt added a comment - That should of course be : Element child = document. createElement(nodes [nodes.length - 1] ); parent.appendChild(child); if (attName == null) { CharacterData data = document.createTextNode(value.toString()); child.appendChild(data); } else { child.setAttribute(attName, value.toString); }
        Hide
        Emmanuel Bourg added a comment -

        Tested and fixed!

        Show
        Emmanuel Bourg added a comment - Tested and fixed!
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 30839 12341657
        Henri Yandell made changes -
        Affects Version/s Nightly Builds [ 12311648 ]
        Component/s Configuration [ 12311107 ]
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Project Commons [ 12310458 ] Commons Configuration [ 12310467 ]
        Key COM-1505 CONFIGURATION-25
        Henri Yandell made changes -
        Affects Version/s Nightly Builds [ 12311710 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Hermod Opstvedt
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development