8078596: jaxp tests failed in modular jdk due to internal class access
authorjoehw
Fri, 15 May 2015 16:26:03 -0700
changeset 30707 47b636cd6456
parent 30531 4915246064b2
child 30708 4a2e0a5ac013
8078596: jaxp tests failed in modular jdk due to internal class access Reviewed-by: alanb, lancea, joehw Contributed-by: frank.yuan@oracle.com
jaxp/test/javax/xml/jaxp/TEST.properties
jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java
jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java
jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java
jaxp/test/javax/xml/jaxp/internaltest/TEST.properties
jaxp/test/javax/xml/jaxp/internaltest/javax/xml/common/bug6979306/Bug6979306Test.java
jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java
jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java
jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java
jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml
jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl
jaxp/test/javax/xml/jaxp/libs/test/auctionportal/HiBidConstants.java
jaxp/test/javax/xml/jaxp/unittest/TEST.properties
jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6979306Test.java
jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug7143711Test.java
jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8003147Test.java
jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NamespaceTest.java
jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6551616.java
jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CLITest.java
jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java
--- a/jaxp/test/javax/xml/jaxp/TEST.properties	Wed Jul 05 20:33:55 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-# jaxp test uses TestNG
-TestNG.dirs = unittest
-
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java	Wed Jul 05 20:33:55 2017 +0200
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java	Fri May 15 16:26:03 2015 -0700
@@ -22,8 +22,8 @@
  */
 package test.auctionportal;
 
-import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_LANGUAGE;
-import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_SOURCE;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java	Wed Jul 05 20:33:55 2017 +0200
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java	Fri May 15 16:26:03 2015 -0700
@@ -22,10 +22,10 @@
  */
 package test.auctionportal;
 
-import static com.sun.org.apache.xerces.internal.impl.Constants.SP_ENTITY_EXPANSION_LIMIT;
-import static com.sun.org.apache.xerces.internal.impl.Constants.SP_MAX_OCCUR_LIMIT;
-import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_LANGUAGE;
-import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_SOURCE;
+import static test.auctionportal.HiBidConstants.SP_ENTITY_EXPANSION_LIMIT;
+import static test.auctionportal.HiBidConstants.SP_MAX_OCCUR_LIMIT;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
 import static org.testng.Assert.assertTrue;
 import java.io.File;
 import java.io.FileInputStream;
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java	Wed Jul 05 20:33:55 2017 +0200
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java	Fri May 15 16:26:03 2015 -0700
@@ -22,7 +22,7 @@
  */
 package test.auctionportal;
 
-import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
 import static org.testng.Assert.assertFalse;
 import java.io.FileOutputStream;
 import java.nio.file.Files;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/internaltest/TEST.properties	Fri May 15 16:26:03 2015 -0700
@@ -0,0 +1,3 @@
+# jaxp test uses TestNG
+TestNG.dirs = javax/xml/common/bug6979306 javax/xml/parsers/bug8003147 javax/xml/transform/bug6551616 javax/xml/transform/cli
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/common/bug6979306/Bug6979306Test.java	Fri May 15 16:26:03 2015 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 2015, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @modules java.xml/com.sun.org.apache.xerces.internal.impl
+ *          java.xml/com.sun.org.apache.xalan.internal
+ *          java.xml/com.sun.org.apache.xalan.internal.xslt
+ * @bug 6979306
+ * @summary Test JAXP component version.
+ */
+
+import org.testng.annotations.Test;
+
+import com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck;
+
+public class Bug6979306Test {
+
+    @Test
+    public void test() {
+        String[] input = {};
+        EnvironmentCheck.main(input);
+        com.sun.org.apache.xerces.internal.impl.Version.main(input);
+        com.sun.org.apache.xalan.internal.Version._main(input);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java	Fri May 15 16:26:03 2015 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, 2015, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @modules java.xml/com.sun.org.apache.bcel.internal.classfile
+ *          java.xml/com.sun.org.apache.bcel.internal.generic
+ * @bug 8003147
+ * @summary Test port fix for BCEL bug 39695.
+ */
+
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.sun.org.apache.bcel.internal.classfile.ClassParser;
+import com.sun.org.apache.bcel.internal.classfile.ConstantClass;
+import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
+import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
+import com.sun.org.apache.bcel.internal.classfile.JavaClass;
+import com.sun.org.apache.bcel.internal.classfile.Method;
+import com.sun.org.apache.bcel.internal.generic.ClassGen;
+import com.sun.org.apache.bcel.internal.generic.MethodGen;
+
+public class Bug8003147Test {
+
+    @Test
+    public void test() throws Exception {
+        String classfile = getClass().getResource("Bug8003147Test.class").getPath();
+        JavaClass jc = new ClassParser(classfile).parse();
+        // rename class
+        ConstantPool cp = jc.getConstantPool();
+        int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex();
+        cp.setConstant(cpIndex, new ConstantUtf8("Bug8003147TestPrime"));
+        ClassGen gen = new ClassGen(jc);
+        Method[] methods = jc.getMethods();
+        int index;
+        for (index = 0; index < methods.length; index++) {
+            if (methods[index].getName().equals("doSomething")) {
+                break;
+            }
+        }
+        Method m = methods[index];
+        MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool());
+        gen.replaceMethod(m, mg.getMethod());
+        String path = classfile.replace("Bug8003147Test", "Bug8003147TestPrime");
+        gen.getJavaClass().dump(new FileOutputStream(path));
+
+        try {
+            Class.forName("Bug8003147TestPrime");
+        } catch (ClassFormatError cfe) {
+            cfe.printStackTrace();
+            Assert.fail("modified version of class does not pass verification");
+        }
+    }
+
+    public void doSomething(double d, ArrayList<Integer> list) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java	Fri May 15 16:26:03 2015 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 2015, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @modules java.xml/com.sun.org.apache.xalan.internal.xsltc.trax
+ * @bug 6551616
+ * @summary Test SAX2StAXEventWriter.
+ */
+
+import java.io.InputStream;
+import java.io.StringBufferInputStream;
+
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.testng.annotations.Test;
+
+import com.sun.org.apache.xalan.internal.xsltc.trax.SAX2StAXEventWriter;
+
+public class Bug6551616 {
+    String _cache = "";
+
+
+    @Test
+    public void test() throws Exception {
+        final String XML = "" + "<?xml version='1.0'?>" + "<doc xmlns:foo='http://example.com/foo/' xml:lang='us-en'><p>Test</p></doc>";
+
+        javax.xml.parsers.SAXParserFactory saxFactory = javax.xml.parsers.SAXParserFactory.newInstance();
+
+        javax.xml.parsers.SAXParser parser = saxFactory.newSAXParser();
+
+        XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
+        XMLEventWriter writer = outFactory.createXMLEventWriter(System.out);
+
+        SAX2StAXEventWriter handler = new SAX2StAXEventWriter(writer);
+
+        InputStream is = new StringBufferInputStream(XML);
+
+        parser.parse(is, handler);
+
+        // if it doesn't blow up, it succeeded.
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java	Fri May 15 16:26:03 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, 2015, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @modules java.xml/com.sun.org.apache.xalan.internal.xslt
+ * @summary Test internal transform CLI.
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class CLITest {
+
+    @Test
+    public void testCLI() {
+        try {
+            String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(), "-IN",
+                    getClass().getResource("tigertest-in.xml").toString(), };
+            com.sun.org.apache.xalan.internal.xslt.Process._main(args);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml	Fri May 15 16:26:03 2015 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style"  office:class="text" office:version="1.0">
+	<office:styles>
+		<style:default-style style:family="graphics"/>
+		<style:default-style style:family="paragraph"/>
+	</office:styles>
+</office:document>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl	Fri May 15 16:26:03 2015 -0700
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns:office="http://openoffice.org/2000/office"
+		xmlns:style="http://openoffice.org/2000/style">
+
+	<xsl:output method="xml" encoding="UTF-8"/>
+
+	<xsl:template match="/">
+		<xsl:variable name="copyData">
+			<xsl:call-template name="copy-by-template" />
+		</xsl:variable>
+		<test>
+  		   <xsl:copy-of select="$copyData"/>
+		</test>
+	</xsl:template>
+
+	<xsl:template name="copy-by-template">
+		<xsl:copy-of select="/"/>
+	</xsl:template>
+</xsl:stylesheet>
--- a/jaxp/test/javax/xml/jaxp/libs/test/auctionportal/HiBidConstants.java	Wed Jul 05 20:33:55 2017 +0200
+++ b/jaxp/test/javax/xml/jaxp/libs/test/auctionportal/HiBidConstants.java	Fri May 15 16:26:03 2015 -0700
@@ -42,4 +42,24 @@
      * Name space for account operation.
      */
     public static final String PORTAL_ACCOUNT_NS = "http://www.auctionportal.org/Accounts";
+
+    /**
+     * JAXP schema language property name.
+     */
+    public static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+
+    /**
+     * JAXP schema source property name.
+     */
+    public static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    /**
+     * Name of system property JDK entity expansion limit
+     */
+    public static final String SP_ENTITY_EXPANSION_LIMIT = "jdk.xml.entityExpansionLimit";
+
+    /**
+     * Name of system property JDK maxOccur limit
+     */
+    public static final String SP_MAX_OCCUR_LIMIT = "jdk.xml.maxOccurLimit";
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/TEST.properties	Fri May 15 16:26:03 2015 -0700
@@ -0,0 +1,3 @@
+# jaxp test uses TestNG
+TestNG.dirs = .
+
--- a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6979306Test.java	Wed Jul 05 20:33:55 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2014, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.common;
-
-import org.testng.annotations.Test;
-
-import com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck;
-
-/*
- * @bug 6979306
- * @summary Test JAXP component version.
- */
-public class Bug6979306Test {
-
-    @Test
-    public void test() {
-        String[] input = {};
-        EnvironmentCheck.main(input);
-        com.sun.org.apache.xerces.internal.impl.Version.main(input);
-        com.sun.org.apache.xalan.internal.Version._main(input);
-    }
-
-}
--- a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug7143711Test.java	Wed Jul 05 20:33:55 2017 +0200
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug7143711Test.java	Fri May 15 16:26:03 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -76,7 +76,7 @@
 
     }
 
-    @Test
+    @Test(enabled=false) //skipped due to bug JDK-8080097
     public void testTransform_DOM_withSM() {
         System.out.println("Transform using DOM Source;  Security Manager is set:");
 
@@ -89,7 +89,7 @@
             TransformerFactory factory = TransformerFactory.newInstance("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
                     TransformerFactory.class.getClassLoader());
             factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, true);
-            if (((com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl) factory).useServicesMechnism()) {
+            if ((boolean) factory.getFeature(ORACLE_FEATURE_SERVICE_MECHANISM)) {
                 Assert.fail("should not override in secure mode");
             }
 
--- a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8003147Test.java	Wed Jul 05 20:33:55 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2014, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.parsers;
-
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.sun.org.apache.bcel.internal.classfile.ClassParser;
-import com.sun.org.apache.bcel.internal.classfile.ConstantClass;
-import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
-import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
-import com.sun.org.apache.bcel.internal.classfile.JavaClass;
-import com.sun.org.apache.bcel.internal.classfile.Method;
-import com.sun.org.apache.bcel.internal.generic.ClassGen;
-import com.sun.org.apache.bcel.internal.generic.MethodGen;
-
-/*
- * @bug 8003147
- * @summary Test port fix for BCEL bug 39695.
- */
-public class Bug8003147Test {
-
-    @Test
-    public void test() throws Exception {
-        String classfile = getClass().getResource("Bug8003147Test.class").getPath();
-        JavaClass jc = new ClassParser(classfile).parse();
-        // rename class
-        ConstantPool cp = jc.getConstantPool();
-        int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex();
-        cp.setConstant(cpIndex, new ConstantUtf8("javax/xml/parsers/Bug8003147TestPrime"));
-        ClassGen gen = new ClassGen(jc);
-        Method[] methods = jc.getMethods();
-        int index;
-        for (index = 0; index < methods.length; index++) {
-            if (methods[index].getName().equals("doSomething")) {
-                break;
-            }
-        }
-        Method m = methods[index];
-        MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool());
-        gen.replaceMethod(m, mg.getMethod());
-        String path = classfile.replace("Bug8003147Test", "Bug8003147TestPrime");
-        gen.getJavaClass().dump(new FileOutputStream(path));
-
-        try {
-            Class.forName("javax.xml.parsers.Bug8003147TestPrime");
-        } catch (ClassFormatError cfe) {
-            cfe.printStackTrace();
-            Assert.fail("modified version of class does not pass verification");
-        }
-    }
-
-    public void doSomething(double d, ArrayList<Integer> list) {
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NamespaceTest.java	Wed Jul 05 20:33:55 2017 +0200
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NamespaceTest.java	Fri May 15 16:26:03 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -24,20 +24,16 @@
 package javax.xml.stream.XMLStreamWriterTest;
 
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 
 import javax.xml.XMLConstants;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.stream.StreamResult;
 
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.sun.xml.internal.stream.writers.XMLStreamWriterImpl;
-
 /*
  * @summary Test the writing of Namespaces.
  */
@@ -80,15 +76,10 @@
     private void resetWriter() {
         // reset the Writer
         try {
-            xmlStreamWriter.flush();
-            xmlStreamWriter.close();
-            ((XMLStreamWriterImpl) xmlStreamWriter).reset();
             byteArrayOutputStream.reset();
-            ((XMLStreamWriterImpl) xmlStreamWriter).setOutput(new StreamResult(byteArrayOutputStream), "utf-8");
+            xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(byteArrayOutputStream, "utf-8");
         } catch (XMLStreamException xmlStreamException) {
             Assert.fail(xmlStreamException.toString());
-        } catch (IOException ioException) {
-            Assert.fail(ioException.toString());
         }
     }
 
--- a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6551616.java	Wed Jul 05 20:33:55 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2014, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.transform;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.StringBufferInputStream;
-import java.security.Policy;
-
-import javax.xml.stream.XMLEventWriter;
-import javax.xml.stream.XMLOutputFactory;
-
-import com.sun.org.apache.xalan.internal.xsltc.trax.SAX2StAXEventWriter;
-
-import org.testng.annotations.Test;
-
-/*
- * @bug 6551616
- * @summary Test SAX2StAXEventWriter.
- */
-public class Bug6551616 {
-    String _cache = "";
-
-
-    @Test
-    public void test() throws Exception {
-        final String XML = "" + "<?xml version='1.0'?>" + "<doc xmlns:foo='http://example.com/foo/' xml:lang='us-en'><p>Test</p></doc>";
-
-        javax.xml.parsers.SAXParserFactory saxFactory = javax.xml.parsers.SAXParserFactory.newInstance();
-
-        javax.xml.parsers.SAXParser parser = saxFactory.newSAXParser();
-
-        XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
-        XMLEventWriter writer = outFactory.createXMLEventWriter(System.out);
-
-        SAX2StAXEventWriter handler = new SAX2StAXEventWriter(writer);
-
-        InputStream is = new StringBufferInputStream(XML);
-
-        parser.parse(is, handler);
-
-        // if it doesn't blow up, it succeeded.
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CLITest.java	Wed Jul 05 20:33:55 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2014, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.transform;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/*
- * @summary Test internal transform CLI.
- */
-public class CLITest {
-
-    @Test
-    public void testCLI() {
-        try {
-            String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(), "-IN",
-                    getClass().getResource("tigertest-in.xml").toString(), };
-            com.sun.org.apache.xalan.internal.xslt.Process._main(args);
-        } catch (Exception e) {
-            Assert.fail(e.getMessage());
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java	Wed Jul 05 20:33:55 2017 +0200
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java	Fri May 15 16:26:03 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -42,12 +42,12 @@
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
-import com.sun.org.apache.xerces.internal.impl.Constants;
 
 /*
  * @summary Test LSSerializer.
  */
 public class LSSerializerTest {
+    private static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print";
 
     class DOMErrorHandlerImpl implements DOMErrorHandler {
 
@@ -192,47 +192,47 @@
         DOMConfiguration domConfiguration = lsSerializer.getDomConfig();
 
         // query current configuration
-        Boolean defaultFormatPrettyPrint = (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT);
-        Boolean canSetFormatPrettyPrintFalse = (Boolean) domConfiguration.canSetParameter(Constants.DOM_FORMAT_PRETTY_PRINT, Boolean.FALSE);
-        Boolean canSetFormatPrettyPrintTrue = (Boolean) domConfiguration.canSetParameter(Constants.DOM_FORMAT_PRETTY_PRINT, Boolean.TRUE);
+        Boolean defaultFormatPrettyPrint = (Boolean) domConfiguration.getParameter(DOM_FORMAT_PRETTY_PRINT);
+        Boolean canSetFormatPrettyPrintFalse = (Boolean) domConfiguration.canSetParameter(DOM_FORMAT_PRETTY_PRINT, Boolean.FALSE);
+        Boolean canSetFormatPrettyPrintTrue = (Boolean) domConfiguration.canSetParameter(DOM_FORMAT_PRETTY_PRINT, Boolean.TRUE);
 
-        System.out.println(Constants.DOM_FORMAT_PRETTY_PRINT + " default/can set false/can set true = " + defaultFormatPrettyPrint + "/"
+        System.out.println(DOM_FORMAT_PRETTY_PRINT + " default/can set false/can set true = " + defaultFormatPrettyPrint + "/"
                 + canSetFormatPrettyPrintFalse + "/" + canSetFormatPrettyPrintTrue);
 
         // test values
-        Assert.assertEquals(defaultFormatPrettyPrint, Boolean.FALSE, "Default value of " + Constants.DOM_FORMAT_PRETTY_PRINT + " should be " + Boolean.FALSE);
+        Assert.assertEquals(defaultFormatPrettyPrint, Boolean.FALSE, "Default value of " + DOM_FORMAT_PRETTY_PRINT + " should be " + Boolean.FALSE);
 
-        Assert.assertEquals(canSetFormatPrettyPrintFalse, Boolean.TRUE, "Can set " + Constants.DOM_FORMAT_PRETTY_PRINT + " to " + Boolean.FALSE + " should be "
+        Assert.assertEquals(canSetFormatPrettyPrintFalse, Boolean.TRUE, "Can set " + DOM_FORMAT_PRETTY_PRINT + " to " + Boolean.FALSE + " should be "
                 + Boolean.TRUE);
 
-        Assert.assertEquals(canSetFormatPrettyPrintTrue, Boolean.TRUE, "Can set " + Constants.DOM_FORMAT_PRETTY_PRINT + " to " + Boolean.TRUE + " should be "
+        Assert.assertEquals(canSetFormatPrettyPrintTrue, Boolean.TRUE, "Can set " + DOM_FORMAT_PRETTY_PRINT + " to " + Boolean.TRUE + " should be "
                 + Boolean.TRUE);
 
         // get default serialization
         String prettyPrintDefault = lsSerializer.writeToString(document);
-        System.out.println("(default) " + Constants.DOM_FORMAT_PRETTY_PRINT + "==" + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT)
+        System.out.println("(default) " + DOM_FORMAT_PRETTY_PRINT + "==" + (Boolean) domConfiguration.getParameter(DOM_FORMAT_PRETTY_PRINT)
                 + ": \n\"" + prettyPrintDefault + "\"");
 
-        Assert.assertEquals(XML_DOCUMENT_DEFAULT_PRINT, prettyPrintDefault, "Invalid serialization with default value, " + Constants.DOM_FORMAT_PRETTY_PRINT + "=="
-                + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT));
+        Assert.assertEquals(XML_DOCUMENT_DEFAULT_PRINT, prettyPrintDefault, "Invalid serialization with default value, " + DOM_FORMAT_PRETTY_PRINT + "=="
+                + (Boolean) domConfiguration.getParameter(DOM_FORMAT_PRETTY_PRINT));
 
         // configure LSSerializer to not format-pretty-print
-        domConfiguration.setParameter(Constants.DOM_FORMAT_PRETTY_PRINT, Boolean.FALSE);
+        domConfiguration.setParameter(DOM_FORMAT_PRETTY_PRINT, Boolean.FALSE);
         String prettyPrintFalse = lsSerializer.writeToString(document);
-        System.out.println("(FALSE) " + Constants.DOM_FORMAT_PRETTY_PRINT + "==" + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT)
+        System.out.println("(FALSE) " + DOM_FORMAT_PRETTY_PRINT + "==" + (Boolean) domConfiguration.getParameter(DOM_FORMAT_PRETTY_PRINT)
                 + ": \n\"" + prettyPrintFalse + "\"");
 
-        Assert.assertEquals(XML_DOCUMENT_DEFAULT_PRINT, prettyPrintFalse, "Invalid serialization with FALSE value, " + Constants.DOM_FORMAT_PRETTY_PRINT + "=="
-                + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT));
+        Assert.assertEquals(XML_DOCUMENT_DEFAULT_PRINT, prettyPrintFalse, "Invalid serialization with FALSE value, " + DOM_FORMAT_PRETTY_PRINT + "=="
+                + (Boolean) domConfiguration.getParameter(DOM_FORMAT_PRETTY_PRINT));
 
         // configure LSSerializer to format-pretty-print
-        domConfiguration.setParameter(Constants.DOM_FORMAT_PRETTY_PRINT, Boolean.TRUE);
+        domConfiguration.setParameter(DOM_FORMAT_PRETTY_PRINT, Boolean.TRUE);
         String prettyPrintTrue = lsSerializer.writeToString(document);
-        System.out.println("(TRUE) " + Constants.DOM_FORMAT_PRETTY_PRINT + "==" + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT)
+        System.out.println("(TRUE) " + DOM_FORMAT_PRETTY_PRINT + "==" + (Boolean) domConfiguration.getParameter(DOM_FORMAT_PRETTY_PRINT)
                 + ": \n\"" + prettyPrintTrue + "\"");
 
-        Assert.assertEquals(XML_DOCUMENT_PRETTY_PRINT, prettyPrintTrue, "Invalid serialization with TRUE value, " + Constants.DOM_FORMAT_PRETTY_PRINT + "=="
-                + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT));
+        Assert.assertEquals(XML_DOCUMENT_PRETTY_PRINT, prettyPrintTrue, "Invalid serialization with TRUE value, " + DOM_FORMAT_PRETTY_PRINT + "=="
+                + (Boolean) domConfiguration.getParameter(DOM_FORMAT_PRETTY_PRINT));
     }
 
     @Test