More bug fixes for the parser and related classes. 2006-04-12 Lillian Angel <[EMAIL PROTECTED]>
* gnu/xml/dom/DomDocument.java (checkNCName): Removed unneeded part of check. * gnu/xml/dom/DomNode.java (dispatchEvent): Added code to grow ancestors array if needed. Changed checks to use depth of node instead. Fixes an infinite loop and segmentation fault. * gnu/xml/dom/html2/DomHTMLParser.java (handleEndTag): No need to use/make a copy of the node. Causes an infinite loop. On Tue, 2006-04-11 at 14:07 -0400, Lillian Angel wrote: > I have changed gcjwebplugin to use the parser in > gnu/xml/dom/html2/*. > > I added some needed functions/classes. Also, fixed a few minor bugs in > the parser and awt. > > 2006-04-11 Lillian Angel <[EMAIL PROTECTED]> > > * gnu/xml/dom/DomNodeIterator.java > (nextNode): Moved line of code to avoid an infinite loop. > * gnu/xml/dom/html2/DomHTMLAppletElement.java > (getCls): New function. > (setCls): Likewise. > (getSrc): Likewise. > (setSrc): Likewise. > * gnu/xml/dom/html2/DomHTMLDocument.java: > Added DomHTMLEmbedElement to map. > (getApplets): Added node name, 'embed'. > * gnu/xml/dom/html2/DomHTMLEmbedElement.java: > New class. > * gnu/xml/dom/html2/DomHTMLObjectElement.java > (getJavaCode): New function. > (setJavaCode): Likewise. > (getObject): Likewise. > (setObject): Likewise. > (getJavaObject): Likewise. > (setJavaObject): Likewise. > (getJavaArchive): Likewise. > (setJavaArchive): Likewise. > (getJavaCodeBase): Likewise. > (setJavaCodeBase): Likewise. > (getJavaType): Likewise. > (setJavaType): Likewise. > (setMayscript): Likewise. > (getMayscript): Likewise. > (setScriptable): Likewise. > (getScriptable): Likewise. > * gnu/xml/dom/html2/DomHTMLParser.java > (parseDocument): Should not check for well formedness > when parsing an html document. > * java/awt/Window.java > (dispatchEvent): Added check to avoid NPE. >
Index: gnu/xml/dom/DomDocument.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomDocument.java,v retrieving revision 1.8 diff -u -r1.8 DomDocument.java --- gnu/xml/dom/DomDocument.java 12 Jan 2006 16:35:52 -0000 1.8 +++ gnu/xml/dom/DomDocument.java 12 Apr 2006 16:04:42 -0000 @@ -535,8 +535,7 @@ int index = name.indexOf(':'); if (index != -1) { - if (index == 0 || index == (len - 1) || - name.lastIndexOf(':') != index) + if (index == 0 || name.lastIndexOf(':') != index) { throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); Index: gnu/xml/dom/DomNode.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomNode.java,v retrieving revision 1.13 diff -u -r1.13 DomNode.java --- gnu/xml/dom/DomNode.java 12 Jan 2006 19:46:59 -0000 1.13 +++ gnu/xml/dom/DomNode.java 12 Apr 2006 16:04:42 -0000 @@ -1120,7 +1120,6 @@ node.appendChild(newChild); } } - if (nodeType == ENTITY_REFERENCE_NODE) { node.makeReadonly(); @@ -1556,23 +1555,30 @@ ancestorLen = ancestors.length; } - // XXX autogrow ancestors ... based on statistics - // Climb to the top of this subtree and handle capture, letting // each node (from the top down) capture until one stops it or // until we get to this one. - - for (index = 0, current = parent; - current != null && index < ancestorLen; - index++, current = current.parent) + current = parent; + if (current.depth >= ANCESTORS_INIT) + { + DomNode[] newants = new DomNode[current.depth + 1]; + System.arraycopy(ancestors, 0, newants, 0, ancestors.length); + ancestors = newants; + ancestorLen = ancestors.length; + } + for (index = 0; index < ancestorLen; index++) { + if (current == null || current.depth == 0) + break; + if (current.nListeners != 0) { haveAncestorRegistrations = true; } ancestors [index] = current; + current = current.parent; } - if (current != null) + if (current.depth > 0) { throw new RuntimeException("dispatchEvent capture stack size"); } Index: gnu/xml/dom/html2/DomHTMLParser.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/html2/DomHTMLParser.java,v retrieving revision 1.4 diff -u -r1.4 DomHTMLParser.java --- gnu/xml/dom/html2/DomHTMLParser.java 11 Apr 2006 18:05:49 -0000 1.4 +++ gnu/xml/dom/html2/DomHTMLParser.java 12 Apr 2006 16:04:42 -0000 @@ -225,7 +225,6 @@ open.addFirst(close); close = close.getParentNode(); } - if (close == null) cursor = document; else @@ -236,9 +235,8 @@ while (iter.hasNext()) { Node item = (Node) iter.next(); - Node copy = item.cloneNode(true); - cursor.appendChild(copy); - cursor = copy; + cursor.appendChild(item); + cursor = item; } } }