Skip to content

Commit 4c54fa2

Browse files
fgualliniFrank Yuan
authored and
Frank Yuan
committedMay 15, 2020
8209774: Refactor shell test javax/xml/jaxp/common/8035437/run.sh to java
Reviewed-by: dfuchs, joehw, alanb
1 parent b883bad commit 4c54fa2

File tree

5 files changed

+22
-82
lines changed

5 files changed

+22
-82
lines changed
 

‎test/jdk/javax/xml/jaxp/common/8035437/AbstractMethodErrorTest.java

+22-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,26 @@
2828
import org.w3c.dom.ls.DOMImplementationLS;
2929
import org.w3c.dom.ls.LSSerializer;
3030

31-
class AbstractMethodErrorTest {
31+
/*
32+
* @test
33+
* @bug 8035437
34+
* @summary Verifies that java.lang.AbstractMethodError is not thrown when
35+
* serializing improper version of DocumentImpl class as reported in XERCESJ-1007.
36+
* Test preconditions and steps:
37+
* - Compiles test version of org.w3c.dom.Node and org.w3c.dom.Document
38+
* - Compiles DocumentImpl overriding java.xml module with Node and Document
39+
* - Runs AbstractMethodErrorTest overriding java.xml only with DocumentImpl class
40+
* Hence, the interfaces compiled in the first step need to be removed
41+
* from the test folder in order to reproduce the bug scenario. At the time of writing,
42+
* the clean command was not able to resolve paths generated by compile/module
43+
* @library /test/lib
44+
* @compile --patch-module java.xml=${test.src} org/w3c/dom/Document.java
45+
* org/w3c/dom/Node.java com/sun/org/apache/xerces/internal/dom/DocumentImpl.java
46+
* @clean org.w3c.dom.*
47+
* @run main/othervm --patch-module java.xml=${test.class.path} AbstractMethodErrorTest
48+
*/
49+
50+
public class AbstractMethodErrorTest {
3251

3352
public static void main(String[] args) throws Exception {
3453
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@@ -39,11 +58,7 @@ public static void main(String[] args) throws Exception {
3958
DOMImplementationLS implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0");
4059
LSSerializer dsi = implLS.createLSSerializer();
4160

42-
/* We should have here incorrect document without getXmlVersion() method:
43-
* Such Document is generated by replacing the JDK bootclasses with it's
44-
* own Node,Document and DocumentImpl classes (see run.sh). According to
45-
* XERCESJ-1007 the AbstractMethodError should be thrown in such case.
46-
*/
61+
// We should have here incorrect document without getXmlVersion() method
4762
String result = dsi.writeToString(document);
4863
System.out.println("Result:" + result);
4964
}

‎test/jdk/javax/xml/jaxp/common/8035437/run.sh

-75
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.