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

        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!

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development