You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2003/06/02 22:41:44 UTC

DO NOT REPLY [Bug 20429] New: - DOM3: Invalid Boolean Object test in DOMConfigurationImpl.setParameter

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

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20429

DOM3: Invalid Boolean Object test in DOMConfigurationImpl.setParameter

           Summary: DOM3: Invalid Boolean Object test in
                    DOMConfigurationImpl.setParameter
           Product: Xerces2-J
           Version: 2.4.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: DOM
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: CTDay@LBL.Gov


Regarding the DOM3 Level experimental implementation in Xerces2-J:

There is a coding error in 

org.apache.xerces.dom.DOMConfigurationImpl.setParameter(String name, Object 
value).

The error is in the first two lines:

 if (value == Boolean.TRUE || value == Boolean.FALSE) {
     boolean state = (value == Boolean.TRUE) ? true : false;
     .
     .
     .

Since the value argument is a Boolean _Object_ and not a primitive, the == 
operator compares identity of objects, not equivalence of Boolean values. 
Since I pass a Boolean Object that is freshly allocated (actually, I don't but 
the Jython runtime does), the == is not satisfied and the code drops through 
to the default, FEATURE_NOT_FOUND. The check should be done the same way the 
name check is done, viz.

 if (value.equals(Boolean.TRUE) || value.equals(Boolean.FALSE) {
     boolean state = (value.equals(Boolean.TRUE) ? true : false;
     .
     .
     .

or, more succinctly,

 if (value instanceof Boolean) {
     boolean state = value.booleanValue()

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org