From d78a5bc2c1866096d3889fca91ac94dfb048d9b7 Mon Sep 17 00:00:00 2001 From: Aleksei Efimov Date: Fri, 29 May 2015 12:28:46 +0300 Subject: [PATCH] 8081392: getNodeValue should return 'null' value for Element nodes Reviewed-by: joehw --- jdk/test/javax/xml/jaxp/common/8032908/TestFunc.java | 5 +++-- jdk/test/javax/xml/jaxp/common/8032908/XSLT.java | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/jdk/test/javax/xml/jaxp/common/8032908/TestFunc.java b/jdk/test/javax/xml/jaxp/common/8032908/TestFunc.java index 20eb23fa513..62a18f77749 100644 --- a/jdk/test/javax/xml/jaxp/common/8032908/TestFunc.java +++ b/jdk/test/javax/xml/jaxp/common/8032908/TestFunc.java @@ -26,8 +26,9 @@ import org.w3c.dom.Node; 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; } } diff --git a/jdk/test/javax/xml/jaxp/common/8032908/XSLT.java b/jdk/test/javax/xml/jaxp/common/8032908/XSLT.java index 77ddcbcfaea..22a4346edae 100644 --- a/jdk/test/javax/xml/jaxp/common/8032908/XSLT.java +++ b/jdk/test/javax/xml/jaxp/common/8032908/XSLT.java @@ -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 @@ public class XSLT { static final String XMLTOTRANSFORM = "/in.xml"; static final String XSLTRANSFORMER = "/test.xsl"; - static final String EXPECTEDRESULT = "ABCDEFG"; + static final String EXPECTEDRESULT = "ABCDEFG:null"; public static void main(String[] args) throws TransformerException { ByteArrayOutputStream resStream = new ByteArrayOutputStream();