mrglavas 2004/03/02 13:57:34 Modified: java/src/org/apache/xerces/dom ParentNode.java CoreDocumentImpl.java Log: Fixing Bugs 26964 & 27350:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26964 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27350 In both cases we were raising the wrong exception because getOwnerDocument for a Document node returns null. Thanks to Curt Arnold and Naela Nissar for locating these bugs. Revision Changes Path 1.43 +2 -2 xml-xerces/java/src/org/apache/xerces/dom/ParentNode.java Index: ParentNode.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ParentNode.java,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- ParentNode.java 24 Feb 2004 23:23:17 -0000 1.42 +++ ParentNode.java 2 Mar 2004 21:57:34 -0000 1.43 @@ -342,7 +342,7 @@ DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null)); } - if (newChild.getOwnerDocument() != ownerDocument) { + if (newChild.getOwnerDocument() != ownerDocument && newChild != ownerDocument) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null)); } 1.66 +2 -2 xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java Index: CoreDocumentImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- CoreDocumentImpl.java 24 Feb 2004 23:23:17 -0000 1.65 +++ CoreDocumentImpl.java 2 Mar 2004 21:57:34 -0000 1.66 @@ -864,7 +864,7 @@ public Node renameNode(Node n,String namespaceURI,String name) throws DOMException{ - if (n.getOwnerDocument() != this) { + if (n.getOwnerDocument() != this && n != this) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null); throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]