8081392: getNodeValue should return 'null' value for Element nodes
authoraefimov
Fri, 29 May 2015 12:28:46 +0300
changeset 30895 afe118ae4566
parent 30894 917063bb7b0f
child 30896 7d150914095e
8081392: getNodeValue should return 'null' value for Element nodes Reviewed-by: joehw
jdk/test/javax/xml/jaxp/common/8032908/TestFunc.java
jdk/test/javax/xml/jaxp/common/8032908/XSLT.java
--- a/jdk/test/javax/xml/jaxp/common/8032908/TestFunc.java	Fri May 29 09:41:20 2015 +0800
+++ b/jdk/test/javax/xml/jaxp/common/8032908/TestFunc.java	Fri May 29 12:28:46 2015 +0300
@@ -26,8 +26,9 @@
 public class TestFunc {
 
     public static String test(Node node) {
-        String s = node.getTextContent();
-        return s;
+        String textContent = node.getTextContent();
+        String nodeValue   = node.getNodeValue();
+        return textContent + ":" + nodeValue;
     }
 
 }
--- a/jdk/test/javax/xml/jaxp/common/8032908/XSLT.java	Fri May 29 09:41:20 2015 +0800
+++ b/jdk/test/javax/xml/jaxp/common/8032908/XSLT.java	Fri May 29 12:28:46 2015 +0300
@@ -23,9 +23,10 @@
 
 /**
  * @test
- * @bug 8032908
+ * @bug 8032908 8081392
  * @summary Test if Node.getTextContent() function correctly returns children
- * content
+ * content and also check that Node.getNodeValue() returns null value for
+ * Element nodes
  * @compile TestFunc.java XSLT.java
  * @run main/othervm XSLT
  */
@@ -40,7 +41,7 @@
 
     static final String XMLTOTRANSFORM = "/in.xml";
     static final String XSLTRANSFORMER = "/test.xsl";
-    static final String EXPECTEDRESULT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>ABCDEFG";
+    static final String EXPECTEDRESULT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>ABCDEFG:null";
 
     public static void main(String[] args) throws TransformerException {
         ByteArrayOutputStream resStream = new ByteArrayOutputStream();