changeset 31286:4c6b605ceb9f

8080266: Failed to create CharInfo due to ResourceBundle update for modules Summary: Fixed the initialization of LSSerializerImpl. Reviewed-by: joehw, dfuchs
author fyuan
date Thu, 25 Jun 2015 11:06:28 +0200
parents 2dec844adc37
children d6581a7c221f
files jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDOMImplementationImpl.java jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/LSSerializerImpl.java jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java
diffstat 3 files changed, 26 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDOMImplementationImpl.java	Wed Jun 24 15:18:44 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDOMImplementationImpl.java	Thu Jun 25 11:06:28 2015 +0200
@@ -343,10 +343,7 @@
          */
         public LSSerializer createLSSerializer() {
             try {
-                Class serializerClass = ObjectFactory.findProviderClass(
-                    "com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl",
-                    ObjectFactory.findClassLoader(), true);
-                return (LSSerializer) serializerClass.newInstance();
+                return new com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl();
             }
             catch (Exception e) {}
             // Fall back to Xerces' deprecated serializer if
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/LSSerializerImpl.java	Wed Jun 24 15:18:44 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/dom3/LSSerializerImpl.java	Thu Jun 25 11:06:28 2015 +0200
@@ -36,6 +36,7 @@
 import com.sun.org.apache.xml.internal.serializer.DOM3Serializer;
 import com.sun.org.apache.xml.internal.serializer.Encodings;
 import com.sun.org.apache.xml.internal.serializer.Serializer;
+import com.sun.org.apache.xml.internal.serializer.ToXMLStream;
 import com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory;
 import com.sun.org.apache.xml.internal.serializer.SerializerFactory;
 import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
@@ -218,7 +219,8 @@
 
         // Get a serializer that seriailizes according to the properties,
         // which in this case is to xml
-        fXMLSerializer = SerializerFactory.getSerializer(configProps);
+        fXMLSerializer = new ToXMLStream();
+        fXMLSerializer.setOutputFormat(configProps);
 
         // Initialize Serializer
         fXMLSerializer.setOutputFormat(fDOMConfigProperties);
@@ -262,9 +264,6 @@
         // entities
         fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
                 + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_TRUE);
-        // preserve entities
-        fDOMConfigProperties.setProperty(
-                OutputPropertiesFactory.S_KEY_ENTITIES, DOMConstants.S_XSL_VALUE_ENTITIES);
 
         // error-handler
         // Should we set our default ErrorHandler
@@ -290,9 +289,6 @@
                     + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_DEFAULT_TRUE);
             fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
                     + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_FALSE);
-            // preserve entities
-            fDOMConfigProperties.setProperty(
-                    OutputPropertiesFactory.S_KEY_ENTITIES, "");
             fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
                     + DOMConstants.DOM_CDATA_SECTIONS,
                     DOMConstants.DOM3_DEFAULT_FALSE);
@@ -531,8 +527,6 @@
                 if (state) {
                     fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
                             + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_TRUE);
-                    fDOMConfigProperties.setProperty(
-                            OutputPropertiesFactory.S_KEY_ENTITIES, DOMConstants.S_XSL_VALUE_ENTITIES);
                 } else {
                     fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
                             + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE);
@@ -679,31 +673,29 @@
                     fFeatures |= WELLFORMED;
                     fFeatures |= ELEM_CONTENT_WHITESPACE;
                     fFeatures |= COMMENTS;
+
+                    // infoset
+                    fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+                            + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_TRUE);
+                    fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+                            + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_TRUE);
+                    fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+                            + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_TRUE);
+                    fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+                            + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_TRUE);
+                    fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+                            + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_TRUE);
+
+                    fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+                            + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE);
+
+                    fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+                            + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_FALSE);
+                    fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+                            + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_EXPLICIT_FALSE);
+                    fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
+                            + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_EXPLICIT_FALSE);
                 }
-
-                // infoset
-                fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
-                        + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_TRUE);
-                fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
-                        + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_TRUE);
-                fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
-                        + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_TRUE);
-                fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
-                        + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_TRUE);
-                fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
-                        + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_TRUE);
-
-                fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
-                        + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE);
-                fDOMConfigProperties.setProperty(
-                        OutputPropertiesFactory.S_KEY_ENTITIES, "");
-
-                fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
-                        + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_FALSE);
-                fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
-                        + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_EXPLICIT_FALSE);
-                fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS
-                        + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_EXPLICIT_FALSE);
             } else if (name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS)) {
                 String msg = Utils.messages.createMessage(
                     MsgKey.ER_FEATURE_NOT_SUPPORTED,
--- a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java	Wed Jun 24 15:18:44 2015 -0700
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java	Thu Jun 25 11:06:28 2015 +0200
@@ -101,7 +101,6 @@
 
     /*
      * @bug 8080906
-     * It will fail in a Jigsaw build until JDK-8080266 is fixed.
      */
     @Test
     public void testDefaultLSSerializer() throws Exception {