You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/08/25 10:23:41 UTC

DO NOT REPLY [Bug 30839] New: - ClassCastException in XMLConfiguration

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30839>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30839

ClassCastException in XMLConfiguration

           Summary: ClassCastException in XMLConfiguration
           Product: Commons
           Version: Nightly Builds
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Configuration
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: hermod.opstvedt@dnb.no


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

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org