NULL-optimization error + FIX
-----------------------------

         Key: XERCESJ-1074
         URL: http://issues.apache.org/jira/browse/XERCESJ-1074
     Project: Xerces2-J
        Type: Bug
  Components: DOM  
    Versions: 2.6.2    
 Environment: Java 1.4
    Reporter: patins
    Priority: Critical



Hello,

I have written an open-source XML editor at http://xdoc.sourceforge.net using 
Xerces
and have already a fix for following bug:

When executing namespaceFixUp in DOMNormalizer.java, 
some attributes can be
added to the element "element", but this is not accounted for
at following statement in  DOMNormalizer.java:

...
                 AttributeMap attributes = (elem.hasAttributes()) ? 
(AttributeMap) elem.getAttributes() : null;

                 // fix namespaces and remove default attributes
                 if ((fConfiguration.features & 
DOMConfigurationImpl.NAMESPACES) !=0) {
                     // fix namespaces
                     // normalize attribute values
                     // remove default attributes
                     namespaceFixUp(elem, attributes);
                 } else {
...

If attributes are added, then elem.hasAttributes is true,
although it can be false before so that  the variable 
"attributes" is still null although there are attributes now! 
So just the refresh of "attributes" is lacking after executing  namespaceFixUp. 
So I have incoporateded following fix (in my program):


.....
                 AttributeMap attributes = (elem.hasAttributes()) ? 
(AttributeMap) elem.getAttributes() : null;

                 // fix namespaces and remove default attributes
                 if ((fConfiguration.features & 
DOMConfigurationImpl.NAMESPACES) !=0) {
                     // fix namespaces
                     // normalize attribute values
                     // remove default attributes
                     namespaceFixUp(elem, attributes);
                     attributes = (elem.hasAttributes()) ? (AttributeMap) 
elem.getAttributes() : null; //new line
                 } else {
.......
(look at the added "attributes =.." statement.)

and this works perfectly then. The error's effect
appeared as I had loaded a dozen of nested schema files of XHTML
modularization.

Greetings
J�rg


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to