Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -28,7 +28,26 @@
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSSerializer;

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

public class AbstractMethodErrorTest {

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

/* We should have here incorrect document without getXmlVersion() method:
* Such Document is generated by replacing the JDK bootclasses with it's
* own Node,Document and DocumentImpl classes (see run.sh). According to
* XERCESJ-1007 the AbstractMethodError should be thrown in such case.
*/
// We should have here incorrect document without getXmlVersion() method
String result = dsi.writeToString(document);
System.out.println("Result:" + result);
}
Expand Down
75 changes: 0 additions & 75 deletions test/jdk/javax/xml/jaxp/common/8035437/run.sh

This file was deleted.