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=22329>. 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=22329 DOM L2 Ranges Errata range-1 2001-01-17. WRONG_DOCUMENT_ERR exception missing Summary: DOM L2 Ranges Errata range-1 2001-01-17. WRONG_DOCUMENT_ERR exception missing Product: Xerces2-J Version: 2.5.0 Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: DOM AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] As stated in the DOM L2 Ranges Errata - range-1 2001-01-17, a WRONG_DOCUMENT_ERR exception is required to be raised for methods selectNode, selectNodeContents, setStart, setStartAfter, setStartBefore, setEnd, setEndAfter, and setEndBefore if refNode was created from a different document than the one that created this range, but is missing. Proposed patch ============== Index: org/apache/xerces/dom/RangeImpl.java =================================================================== RCS file: /home/cvspublic/xml- xerces/java/src/org/apache/xerces/dom/RangeImpl.java,v retrieving revision 1.26 diff -u -r1.26 RangeImpl.java --- org/apache/xerces/dom/RangeImpl.java 8 May 2003 19:52:40 -0000 1.26 +++ org/apache/xerces/dom/RangeImpl.java 11 Aug 2003 22:23:27 -0000 @@ -170,7 +170,11 @@ RangeException.INVALID_NODE_TYPE_ERR, DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null)); } - + if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) { + throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, + DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null)); + } + checkIndex(refNode, offset); fStartContainer = refNode; @@ -190,7 +194,11 @@ RangeException.INVALID_NODE_TYPE_ERR, DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null)); } - + if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) { + throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, + DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null)); + } + checkIndex(refNode, offset); fEndContainer = refNode; @@ -211,6 +219,10 @@ RangeException.INVALID_NODE_TYPE_ERR, DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null)); } + if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) { + throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, + DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null)); + } fStartContainer = refNode.getParentNode(); int i = 0; for (Node n = refNode; n!=null; n = n.getPreviousSibling()) { @@ -232,6 +244,10 @@ RangeException.INVALID_NODE_TYPE_ERR, DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null)); } + if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) { + throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, + DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null)); + } fStartContainer = refNode.getParentNode(); int i = 0; for (Node n = refNode; n!=null; n = n.getPreviousSibling()) { @@ -253,6 +269,10 @@ RangeException.INVALID_NODE_TYPE_ERR, DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null)); } + if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) { + throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, + DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null)); + } fEndContainer = refNode.getParentNode(); int i = 0; for (Node n = refNode; n!=null; n = n.getPreviousSibling()) { @@ -275,6 +295,10 @@ RangeException.INVALID_NODE_TYPE_ERR, DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null)); } + if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) { + throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, + DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null)); + } fEndContainer = refNode.getParentNode(); int i = 0; for (Node n = refNode; n!=null; n = n.getPreviousSibling()) { @@ -282,6 +306,7 @@ } fEndOffset = i; } + public void collapse(boolean toStart) { if( fDetach) { @@ -313,6 +338,10 @@ RangeException.INVALID_NODE_TYPE_ERR, DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "INVALID_NODE_TYPE_ERR", null)); } + if ( fDocument != refNode.getOwnerDocument() && fDocument != refNode) { + throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, + DOMMessageFormatter.formatMessage (DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null)); + } Node parent = refNode.getParentNode(); if (parent != null ) // REVIST: what to do if it IS null? { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
