-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
tiger
-
generic
-
generic
-
Verified
Name: eaR10174 Date: 08/29/2003
The method Document.renameNode() does not throw DOMException with the error code
NAMESPACE_ERR in case when the parameter namespaceURI is null and the parameter
qualifiedName has a prefix (see test.java below). According to the method javadoc:
Throws:
DOMException - ...
NAMESPACE_ERR: Raised if the qualifiedName is a malformed qualified name, if the
qualifiedName has a prefix and the namespaceURI is null, or if the qualifiedName
has a prefix that is "xml" and the namespaceURI is different from "
http://www.w3.org/XML/1998/namespace" [XML Namespaces] . Also raised, when the
node being renamed is an attribute, if the qualifiedName, or its prefix, is
"xmlns" and the namespaceURI is different from "http://www.w3.org/2000/xmlns/".
the method should throw DOMException with the error code NAMESPACE_ERR.
The bug appears in jdk1.5.0beta-b17 and affects a new JCK1.5 test:
api/org_w3c/dom/Document/index.html#RenameNode[RenameNode010]
------------------------------------test.java-----------------------------
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.InputSource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.DocumentType;
import java.io.StringReader;
public class test {
public static void main(String argv[]) {
new test().run();
}
public void run() {
try {
DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
docBF.setNamespaceAware(true);
Document doc = docBF.newDocumentBuilder().newDocument();
Element elem = doc.createElement("elem1");
Element elem1 = (Element) doc.renameNode(elem, null, "ns:elem2");
System.out.println("Exception is not thrown.");
} catch (Exception e) {
e.printStackTrace();
return;
}
}
}
--------------------------------------------------------------------------
% java -showversion test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b17)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b17, mixed mode)
Exception is not thrown.
--------------------------------------------------------------------------
======================================================================
The method Document.renameNode() does not throw DOMException with the error code
NAMESPACE_ERR in case when the parameter namespaceURI is null and the parameter
qualifiedName has a prefix (see test.java below). According to the method javadoc:
Throws:
DOMException - ...
NAMESPACE_ERR: Raised if the qualifiedName is a malformed qualified name, if the
qualifiedName has a prefix and the namespaceURI is null, or if the qualifiedName
has a prefix that is "xml" and the namespaceURI is different from "
http://www.w3.org/XML/1998/namespace" [XML Namespaces] . Also raised, when the
node being renamed is an attribute, if the qualifiedName, or its prefix, is
"xmlns" and the namespaceURI is different from "http://www.w3.org/2000/xmlns/".
the method should throw DOMException with the error code NAMESPACE_ERR.
The bug appears in jdk1.5.0beta-b17 and affects a new JCK1.5 test:
api/org_w3c/dom/Document/index.html#RenameNode[RenameNode010]
------------------------------------test.java-----------------------------
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.InputSource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.DocumentType;
import java.io.StringReader;
public class test {
public static void main(String argv[]) {
new test().run();
}
public void run() {
try {
DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
docBF.setNamespaceAware(true);
Document doc = docBF.newDocumentBuilder().newDocument();
Element elem = doc.createElement("elem1");
Element elem1 = (Element) doc.renameNode(elem, null, "ns:elem2");
System.out.println("Exception is not thrown.");
} catch (Exception e) {
e.printStackTrace();
return;
}
}
}
--------------------------------------------------------------------------
% java -showversion test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b17)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b17, mixed mode)
Exception is not thrown.
--------------------------------------------------------------------------
======================================================================