8042889: (props) Properties.loadFromXML/storeToXML should consistently use the UKit parser
authoralanb
Tue, 13 May 2014 11:03:25 +0100
changeset 24371 a9c7b18bf425
parent 24370 1398d972eef1
child 24372 2ff88b15e82e
8042889: (props) Properties.loadFromXML/storeToXML should consistently use the UKit parser Reviewed-by: joehw, chegar, mchung
jdk/make/profile-rtjar-includes.txt
jdk/src/share/classes/java/util/Properties.java
jdk/src/share/classes/jdk/internal/util/xml/BasicXmlPropertiesProvider.java
jdk/src/share/classes/sun/util/spi/XmlPropertiesProvider.java
jdk/src/share/classes/sun/util/xml/META-INF/services/sun.util.spi.XmlPropertiesProvider
jdk/src/share/classes/sun/util/xml/PlatformXmlPropertiesProvider.java
jdk/test/java/util/Properties/CompatibilityTest.java
jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java
jdk/test/java/util/Properties/CustomProvider.java
jdk/test/java/util/Properties/LoadAndStoreXML.java
jdk/test/java/util/Properties/LoadAndStoreXMLWithDefaults.java
jdk/test/java/util/Properties/MyXmlPropertiesProvider.java
--- a/jdk/make/profile-rtjar-includes.txt	Mon May 12 12:35:23 2014 -0400
+++ b/jdk/make/profile-rtjar-includes.txt	Tue May 13 11:03:25 2014 +0100
@@ -100,9 +100,7 @@
 
 PROFILE_2_RTJAR_EXCLUDE_TYPES :=
 
-PROFILE_2_INCLUDE_METAINF_SERVICES := \
-    META-INF/services/sun.util.spi.XmlPropertiesProvider
-
+PROFILE_2_INCLUDE_METAINF_SERVICES :=
 
 PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
     com/sun/jmx \
--- a/jdk/src/share/classes/java/util/Properties.java	Mon May 12 12:35:23 2014 -0400
+++ b/jdk/src/share/classes/java/util/Properties.java	Tue May 13 11:03:25 2014 +0100
@@ -37,7 +37,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
-import sun.util.spi.XmlPropertiesProvider;
+import jdk.internal.util.xml.PropertiesDefaultHandler;
 
 /**
  * The {@code Properties} class represents a persistent set of
@@ -877,7 +877,9 @@
     public synchronized void loadFromXML(InputStream in)
         throws IOException, InvalidPropertiesFormatException
     {
-        XmlSupport.load(this, Objects.requireNonNull(in));
+        Objects.requireNonNull(in);
+        PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
+        handler.load(this, in);
         in.close();
     }
 
@@ -949,8 +951,10 @@
     public void storeToXML(OutputStream os, String comment, String encoding)
         throws IOException
     {
-        XmlSupport.save(this, Objects.requireNonNull(os), comment,
-                        Objects.requireNonNull(encoding));
+        Objects.requireNonNull(os);
+        Objects.requireNonNull(encoding);
+        PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
+        handler.store(this, os, comment, encoding);
     }
 
     /**
@@ -1128,83 +1132,4 @@
     private static final char[] hexDigit = {
         '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
     };
-
-    /**
-     * Supporting class for loading/storing properties in XML format.
-     *
-     * <p> The {@code load} and {@code store} methods defined here delegate to a
-     * system-wide {@code XmlPropertiesProvider}. On first invocation of either
-     * method then the system-wide provider is located as follows: </p>
-     *
-     * <ol>
-     *   <li> If the system property {@code sun.util.spi.XmlPropertiesProvider}
-     *   is defined then it is taken to be the full-qualified name of a concrete
-     *   provider class. The class is loaded with the system class loader as the
-     *   initiating loader. If it cannot be loaded or instantiated using a zero
-     *   argument constructor then an unspecified error is thrown. </li>
-     *
-     *   <li> If the system property is not defined then the service-provider
-     *   loading facility defined by the {@link ServiceLoader} class is used to
-     *   locate a provider with the system class loader as the initiating
-     *   loader and {@code sun.util.spi.XmlPropertiesProvider} as the service
-     *   type. If this process fails then an unspecified error is thrown. If
-     *   there is more than one service provider installed then it is
-     *   not specified as to which provider will be used. </li>
-     *
-     *   <li> If the provider is not found by the above means then a system
-     *   default provider will be instantiated and used. </li>
-     * </ol>
-     */
-    private static class XmlSupport {
-
-        private static XmlPropertiesProvider loadProviderFromProperty(ClassLoader cl) {
-            String cn = System.getProperty("sun.util.spi.XmlPropertiesProvider");
-            if (cn == null)
-                return null;
-            try {
-                Class<?> c = Class.forName(cn, true, cl);
-                return (XmlPropertiesProvider)c.newInstance();
-            } catch (ClassNotFoundException |
-                     IllegalAccessException |
-                     InstantiationException x) {
-                throw new ServiceConfigurationError(null, x);
-            }
-        }
-
-        private static XmlPropertiesProvider loadProviderAsService(ClassLoader cl) {
-            Iterator<XmlPropertiesProvider> iterator =
-                 ServiceLoader.load(XmlPropertiesProvider.class, cl).iterator();
-            return iterator.hasNext() ? iterator.next() : null;
-        }
-
-        private static XmlPropertiesProvider loadProvider() {
-            return AccessController.doPrivileged(
-                new PrivilegedAction<XmlPropertiesProvider>() {
-                    public XmlPropertiesProvider run() {
-                        ClassLoader cl = ClassLoader.getSystemClassLoader();
-                        XmlPropertiesProvider provider = loadProviderFromProperty(cl);
-                        if (provider != null)
-                            return provider;
-                        provider = loadProviderAsService(cl);
-                        if (provider != null)
-                            return provider;
-                        return new jdk.internal.util.xml.BasicXmlPropertiesProvider();
-                }});
-        }
-
-        private static final XmlPropertiesProvider PROVIDER = loadProvider();
-
-        static void load(Properties props, InputStream in)
-            throws IOException, InvalidPropertiesFormatException
-        {
-            PROVIDER.load(props, in);
-        }
-
-        static void save(Properties props, OutputStream os, String comment,
-                         String encoding)
-            throws IOException
-        {
-            PROVIDER.store(props, os, comment, encoding);
-        }
-    }
 }
--- a/jdk/src/share/classes/jdk/internal/util/xml/BasicXmlPropertiesProvider.java	Mon May 12 12:35:23 2014 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2012, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 jdk.internal.util.xml;
-
-import java.util.Properties;
-import java.util.InvalidPropertiesFormatException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-
-import sun.util.spi.XmlPropertiesProvider;
-
-/**
- * A {@code XmlPropertiesProvider} implementation that uses the UKit XML parser.
- */
-
-public class BasicXmlPropertiesProvider extends XmlPropertiesProvider {
-
-    public BasicXmlPropertiesProvider() { }
-
-    @Override
-    public void load(Properties props, InputStream in)
-        throws IOException, InvalidPropertiesFormatException
-    {
-        PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
-        handler.load(props, in);
-    }
-
-    @Override
-    public void store(Properties props, OutputStream os, String comment,
-                      String encoding)
-        throws IOException
-    {
-        PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
-        handler.store(props, os, comment, encoding);
-    }
-}
--- a/jdk/src/share/classes/sun/util/spi/XmlPropertiesProvider.java	Mon May 12 12:35:23 2014 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2012, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.util.spi;
-
-import java.util.Properties;
-import java.util.InvalidPropertiesFormatException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * Service-provider class for loading and storing {@link Properites} in XML
- * format.
- *
- * @see Properties#loadFromXML
- * @see Properties#storeToXML
- */
-
-public abstract class XmlPropertiesProvider {
-
-    /**
-     * Initializes a new instance of this class.
-     */
-    protected XmlPropertiesProvider() {
-        // do nothing for now
-    }
-
-    /**
-     * Loads all of the properties represented by the XML document on the
-     * specified input stream into a properties table.
-     *
-     * @param props the properties table to populate
-     * @param in the input stream from which to read the XML document
-     * @throws IOException if reading from the specified input stream fails
-     * @throws java.io.UnsupportedEncodingException if the document's encoding
-     *         declaration can be read and it specifies an encoding that is not
-     *         supported
-     * @throws InvalidPropertiesFormatException Data on input stream does not
-     *         constitute a valid XML document with the mandated document type.
-     *
-     * @see Properties#loadFromXML
-     */
-    public abstract void load(Properties props, InputStream in)
-        throws IOException, InvalidPropertiesFormatException;
-
-    /**
-     * Emits an XML document representing all of the properties in a given
-     * table.
-     *
-     * @param props the properies to store
-     * @param out the output stream on which to emit the XML document.
-     * @param comment  a description of the property list, can be @{code null}
-     * @param encoding the name of a supported character encoding
-     *
-     * @throws IOException if writing to the specified output stream fails
-     * @throws java.io.UnsupportedEncodingException if the encoding is not
-     *         supported by the implementation
-     * @throws NullPointerException if {@code out} is null.
-     * @throws ClassCastException  if this {@code Properties} object
-     *         contains any keys or values that are not
-     *         {@code Strings}.
-     *
-     * @see Properties#storeToXML
-     */
-    public abstract void store(Properties props, OutputStream out,
-                               String comment, String encoding)
-        throws IOException;
-}
--- a/jdk/src/share/classes/sun/util/xml/META-INF/services/sun.util.spi.XmlPropertiesProvider	Mon May 12 12:35:23 2014 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-sun.util.xml.PlatformXmlPropertiesProvider
--- a/jdk/src/share/classes/sun/util/xml/PlatformXmlPropertiesProvider.java	Mon May 12 12:35:23 2014 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2003, 2013, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.util.xml;
-
-import java.io.*;
-import java.util.*;
-import java.nio.charset.*;
-import java.util.Map.Entry;
-import org.xml.sax.*;
-import org.w3c.dom.*;
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-import javax.xml.transform.stream.*;
-
-import sun.util.spi.XmlPropertiesProvider;
-
-/**
- * A {@code XmlPropertiesProvider} implementation that uses the JAXP API
- * for parsing.
- *
- * @author  Michael McCloskey
- * @since   1.3
- */
-public class PlatformXmlPropertiesProvider extends XmlPropertiesProvider {
-
-    // XML loading and saving methods for Properties
-
-    // The required DTD URI for exported properties
-    private static final String PROPS_DTD_URI =
-    "http://java.sun.com/dtd/properties.dtd";
-
-    private static final String PROPS_DTD =
-    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-    "<!-- DTD for properties -->"                +
-    "<!ELEMENT properties ( comment?, entry* ) >"+
-    "<!ATTLIST properties"                       +
-        " version CDATA #FIXED \"1.0\">"         +
-    "<!ELEMENT comment (#PCDATA) >"              +
-    "<!ELEMENT entry (#PCDATA) >"                +
-    "<!ATTLIST entry "                           +
-        " key CDATA #REQUIRED>";
-
-    /**
-     * Version number for the format of exported properties files.
-     */
-    private static final String EXTERNAL_XML_VERSION = "1.0";
-
-    @Override
-    public void load(Properties props, InputStream in)
-        throws IOException, InvalidPropertiesFormatException
-    {
-        Document doc = null;
-        try {
-            doc = getLoadingDoc(in);
-        } catch (SAXException saxe) {
-            throw new InvalidPropertiesFormatException(saxe);
-        }
-        Element propertiesElement = doc.getDocumentElement();
-        String xmlVersion = propertiesElement.getAttribute("version");
-        if (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0)
-            throw new InvalidPropertiesFormatException(
-                "Exported Properties file format version " + xmlVersion +
-                " is not supported. This java installation can read" +
-                " versions " + EXTERNAL_XML_VERSION + " or older. You" +
-                " may need to install a newer version of JDK.");
-        importProperties(props, propertiesElement);
-    }
-
-    static Document getLoadingDoc(InputStream in)
-        throws SAXException, IOException
-    {
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        dbf.setIgnoringElementContentWhitespace(true);
-        dbf.setValidating(true);
-        dbf.setCoalescing(true);
-        dbf.setIgnoringComments(true);
-        try {
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setEntityResolver(new Resolver());
-            db.setErrorHandler(new EH());
-            InputSource is = new InputSource(in);
-            return db.parse(is);
-        } catch (ParserConfigurationException x) {
-            throw new Error(x);
-        }
-    }
-
-    static void importProperties(Properties props, Element propertiesElement) {
-        NodeList entries = propertiesElement.getChildNodes();
-        int numEntries = entries.getLength();
-        int start = numEntries > 0 &&
-            entries.item(0).getNodeName().equals("comment") ? 1 : 0;
-        for (int i=start; i<numEntries; i++) {
-            Element entry = (Element)entries.item(i);
-            if (entry.hasAttribute("key")) {
-                Node n = entry.getFirstChild();
-                String val = (n == null) ? "" : n.getNodeValue();
-                props.setProperty(entry.getAttribute("key"), val);
-            }
-        }
-    }
-
-    @Override
-    public void store(Properties props, OutputStream os, String comment,
-                      String encoding)
-        throws IOException
-    {
-        // fast-fail for unsupported charsets as UnsupportedEncodingException may
-        // not be thrown later (see JDK-8000621)
-        try {
-            Charset.forName(encoding);
-        } catch (IllegalCharsetNameException | UnsupportedCharsetException x) {
-            throw new UnsupportedEncodingException(encoding);
-        }
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        DocumentBuilder db = null;
-        try {
-            db = dbf.newDocumentBuilder();
-        } catch (ParserConfigurationException pce) {
-            assert(false);
-        }
-        Document doc = db.newDocument();
-        Element properties =  (Element)
-            doc.appendChild(doc.createElement("properties"));
-
-        if (comment != null) {
-            Element comments = (Element)properties.appendChild(
-                doc.createElement("comment"));
-            comments.appendChild(doc.createTextNode(comment));
-        }
-
-        synchronized (props) {
-            for (Entry<Object, Object> e : props.entrySet()) {
-                final Object k = e.getKey();
-                final Object v = e.getValue();
-                if (k instanceof String && v instanceof String) {
-                    Element entry = (Element)properties.appendChild(
-                        doc.createElement("entry"));
-                    entry.setAttribute("key", (String)k);
-                    entry.appendChild(doc.createTextNode((String)v));
-                }
-            }
-        }
-        emitDocument(doc, os, encoding);
-    }
-
-    static void emitDocument(Document doc, OutputStream os, String encoding)
-        throws IOException
-    {
-        TransformerFactory tf = TransformerFactory.newInstance();
-        Transformer t = null;
-        try {
-            t = tf.newTransformer();
-            t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, PROPS_DTD_URI);
-            t.setOutputProperty(OutputKeys.INDENT, "yes");
-            t.setOutputProperty(OutputKeys.METHOD, "xml");
-            t.setOutputProperty(OutputKeys.ENCODING, encoding);
-        } catch (TransformerConfigurationException tce) {
-            assert(false);
-        }
-        DOMSource doms = new DOMSource(doc);
-        StreamResult sr = new StreamResult(os);
-        try {
-            t.transform(doms, sr);
-        } catch (TransformerException te) {
-            throw new IOException(te);
-        }
-    }
-
-    private static class Resolver implements EntityResolver {
-        public InputSource resolveEntity(String pid, String sid)
-            throws SAXException
-        {
-            if (sid.equals(PROPS_DTD_URI)) {
-                InputSource is;
-                is = new InputSource(new StringReader(PROPS_DTD));
-                is.setSystemId(PROPS_DTD_URI);
-                return is;
-            }
-            throw new SAXException("Invalid system identifier: " + sid);
-        }
-    }
-
-    private static class EH implements ErrorHandler {
-        public void error(SAXParseException x) throws SAXException {
-            throw x;
-        }
-        public void fatalError(SAXParseException x) throws SAXException {
-            throw x;
-        }
-        public void warning(SAXParseException x) throws SAXException {
-            throw x;
-        }
-    }
-
-}
--- a/jdk/test/java/util/Properties/CompatibilityTest.java	Mon May 12 12:35:23 2014 -0400
+++ b/jdk/test/java/util/Properties/CompatibilityTest.java	Tue May 13 11:03:25 2014 +0100
@@ -25,8 +25,6 @@
  * @test
  * @bug 8005280 8004371
  * @summary Compatibility test
- * @run main CompatibilityTest
- * @run main/othervm -Dsun.util.spi.XmlPropertiesProvider=jdk.internal.util.xml.BasicXmlPropertiesProvider CompatibilityTest
  */
 
 import java.io.FileInputStream;
--- a/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java	Mon May 12 12:35:23 2014 -0400
+++ b/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java	Tue May 13 11:03:25 2014 +0100
@@ -25,9 +25,6 @@
  * @bug 8005281
  * @summary Test that the Properties storeToXML and loadFromXML methods are
  *   thread safe
- * @run main ConcurrentLoadAndStoreXML
- * @run main/othervm -Dsun.util.spi.XmlPropertiesProvider=jdk.internal.util.xml.BasicXmlPropertiesProvider ConcurrentLoadAndStoreXML
-
  */
 
 import java.io.*;
--- a/jdk/test/java/util/Properties/CustomProvider.java	Mon May 12 12:35:23 2014 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2012, 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
- * @bug 8000354
- * @summary Test
- * @compile -XDignore.symbol.file CustomProvider.java MyXmlPropertiesProvider.java
- * @run main/othervm -Dsun.util.spi.XmlPropertiesProvider=MyXmlPropertiesProvider CustomProvider
- */
-
-import java.util.*;
-import java.io.*;
-
-/**
- * Sanity test to verify that the property sun.util.spi.XmlPropertiesProvider
- * can be used to specify a custom provider for loading/storing properties
- * in XML format.
- */
-public class CustomProvider {
-
-    public static void main(String[] args) throws IOException {
-        String provider = System.getProperty("sun.util.spi.XmlPropertiesProvider");
-        assertTrue(provider != null, "sun.util.spi.XmlPropertiesProvider not set");
-
-        OutputStream out = new ByteArrayOutputStream();
-        InputStream in = new ByteArrayInputStream(new byte[100]);
-
-        Properties props;
-
-        props = new Properties();
-        props.loadFromXML(in);
-
-        props = System.getProperties();
-        props.storeToXML(out, "comment");
-        props.storeToXML(out, "comment", "UTF-8");
-
-        // check that the provider's load and store methods have been invoked
-
-        assertTrue(MyXmlPropertiesProvider.createCount() == 1,
-            "Provider should only be created once");
-        assertTrue(MyXmlPropertiesProvider.loadCount() == 1,
-            "load method expected to be called once");
-        assertTrue(MyXmlPropertiesProvider.storeCount() == 2,
-             "store method expected to be called twice");
-    }
-
-    static void assertTrue(boolean b, String msg) {
-        if (!b) throw new RuntimeException(msg);
-    }
-}
--- a/jdk/test/java/util/Properties/LoadAndStoreXML.java	Mon May 12 12:35:23 2014 -0400
+++ b/jdk/test/java/util/Properties/LoadAndStoreXML.java	Tue May 13 11:03:25 2014 +0100
@@ -25,8 +25,6 @@
  * @test
  * @bug 8000354 8000685 8004371
  * @summary Basic test of storeToXML and loadToXML
- * @run main LoadAndStoreXML
- * @run main/othervm -Dsun.util.spi.XmlPropertiesProvider=jdk.internal.util.xml.BasicXmlPropertiesProvider LoadAndStoreXML
  */
 
 import java.io.*;
--- a/jdk/test/java/util/Properties/LoadAndStoreXMLWithDefaults.java	Mon May 12 12:35:23 2014 -0400
+++ b/jdk/test/java/util/Properties/LoadAndStoreXMLWithDefaults.java	Tue May 13 11:03:25 2014 +0100
@@ -35,58 +35,17 @@
  */
 public class LoadAndStoreXMLWithDefaults {
 
-    public static enum StoreMethod {
-        // Note: this case will test the default provider when available,
-        //       and the basic provider when it's not.
-        PROPERTIES {
-            @Override
-            public String writeToXML(Properties p) throws IOException {
-                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                p.storeToXML(baos, "Test 8016344");
-                return baos.toString();
-            }
-            @Override
-            public Properties loadFromXML(String xml, Properties defaults)
-                    throws IOException {
-                final ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("UTF-8"));
-                Properties p = new Properties(defaults);
-                p.loadFromXML(bais);
-                return p;
-            }
-        },
-        // Note: this case always test the basic provider, which is always available.
-        //       so sometimes it's just a dup with the previous case...
-        BASICPROVIDER {
-            @Override
-            public String writeToXML(Properties p) throws IOException {
-                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                jdk.internal.util.xml.BasicXmlPropertiesProvider provider =
-                        new  jdk.internal.util.xml.BasicXmlPropertiesProvider();
-                provider.store(p, baos, "Test 8016344", "UTF-8");
-                return baos.toString();
-            }
-            @Override
-            public Properties loadFromXML(String xml, Properties defaults)
-                    throws IOException {
-                final ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("UTF-8"));
-                Properties p = new Properties(defaults);
-                jdk.internal.util.xml.BasicXmlPropertiesProvider provider =
-                        new  jdk.internal.util.xml.BasicXmlPropertiesProvider();
-                provider.load(p, bais);
-                return p;
-            }
-        };
-        public abstract String writeToXML(Properties p) throws IOException;
-        public abstract Properties loadFromXML(String xml, Properties defaults)
-                    throws IOException;
-        public String displayName() {
-            switch(this) {
-                case PROPERTIES: return "Properties.storeToXML";
-                case BASICPROVIDER: return "BasicXmlPropertiesProvider.store";
-                default:
-                    throw new UnsupportedOperationException(this.name());
-            }
-        }
+    static String writeToXML(Properties props) throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        props.storeToXML(baos, "Test 8016344");
+        return baos.toString();
+    }
+
+    static Properties loadFromXML(String xml, Properties defaults) throws IOException {
+        ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("UTF-8"));
+        Properties props = new Properties(defaults);
+        props.loadFromXML(bais);
+        return props;
     }
 
     static enum Objects { OBJ1, OBJ2, OBJ3 };
@@ -106,63 +65,59 @@
         p3.setProperty("p1.and.p2.and.p3.prop", "prop9-p3");
         p3.setProperty("p2.and.p3.prop", "prop10-p3");
 
-        for (StoreMethod m : StoreMethod.values()) {
-            System.out.println("Testing with " + m.displayName());
-            Properties P1 = m.loadFromXML(m.writeToXML(p1), null);
-            Properties P2 = m.loadFromXML(m.writeToXML(p2), P1);
-            Properties P3 = m.loadFromXML(m.writeToXML(p3), P2);
+        Properties P1 = loadFromXML(writeToXML(p1), null);
+        Properties P2 = loadFromXML(writeToXML(p2), P1);
+        Properties P3 = loadFromXML(writeToXML(p3), P2);
 
-            testResults(m, p1, P1, p2, P2, p3, P3);
+        testResults(p1, P1, p2, P2, p3, P3);
 
-            // Now check that properties whose keys or values are objects
-            // are skipped.
+        // Now check that properties whose keys or values are objects
+        // are skipped.
 
-            System.out.println("Testing with " + m.displayName() + " and Objects");
-            P1.put("p1.object.prop", Objects.OBJ1);
-            P1.put(Objects.OBJ1, "p1.object.prop");
-            P1.put("p2.object.prop", "p2.object.prop");
-            P2.put("p2.object.prop", Objects.OBJ2);
-            P2.put(Objects.OBJ2, "p2.object.prop");
-            P3.put("p3.object.prop", Objects.OBJ3);
-            P3.put(Objects.OBJ3, "p3.object.prop");
+        P1.put("p1.object.prop", Objects.OBJ1);
+        P1.put(Objects.OBJ1, "p1.object.prop");
+        P1.put("p2.object.prop", "p2.object.prop");
+        P2.put("p2.object.prop", Objects.OBJ2);
+        P2.put(Objects.OBJ2, "p2.object.prop");
+        P3.put("p3.object.prop", Objects.OBJ3);
+        P3.put(Objects.OBJ3, "p3.object.prop");
 
-            Properties PP1 = m.loadFromXML(m.writeToXML(P1), null);
-            Properties PP2 = m.loadFromXML(m.writeToXML(P2), PP1);
-            Properties PP3 = m.loadFromXML(m.writeToXML(P3), PP2);
+        Properties PP1 = loadFromXML(writeToXML(P1), null);
+        Properties PP2 = loadFromXML(writeToXML(P2), PP1);
+        Properties PP3 = loadFromXML(writeToXML(P3), PP2);
 
-            p1.setProperty("p2.object.prop", "p2.object.prop");
-            try {
-                testResults(m, p1, PP1, p2, PP2, p3, PP3);
-            } finally {
-                p1.remove("p2.object.prop");
-            }
+        p1.setProperty("p2.object.prop", "p2.object.prop");
+        try {
+            testResults(p1, PP1, p2, PP2, p3, PP3);
+        } finally {
+            p1.remove("p2.object.prop");
         }
     }
 
-    public static void testResults(StoreMethod m, Properties... pps) {
+    public static void testResults(Properties... pps) {
         for (int i=0 ; i < pps.length ; i += 2) {
             if (!pps[i].equals(pps[i+1])) {
-                System.err.println(m.displayName() +": P" + (i/2+1)
+                System.err.println("P" + (i/2+1)
                         + " Reloaded properties differ from original");
                 System.err.println("\toriginal: " + pps[i]);
                 System.err.println("\treloaded: " + pps[i+1]);
-                throw new RuntimeException(m.displayName() +": P" + (i/2+1)
+                throw new RuntimeException("P" + (i/2+1)
                         + " Reloaded properties differ from original");
             }
             if (!pps[i].keySet().equals(pps[i+1].keySet())) {
-                System.err.println(m.displayName() +": P" + (i/2+1)
+                System.err.println("P" + (i/2+1)
                         + " Reloaded property names differ from original");
                 System.err.println("\toriginal: " + pps[i].keySet());
                 System.err.println("\treloaded: " + pps[i+1].keySet());
-                throw new RuntimeException(m.displayName() +": P" + (i/2+1)
+                throw new RuntimeException("P" + (i/2+1)
                         + " Reloaded property names differ from original");
             }
             if (!pps[i].stringPropertyNames().equals(pps[i+1].stringPropertyNames())) {
-                System.err.println(m.displayName() +": P" + (i/2+1)
+                System.err.println("P" + (i/2+1)
                         + " Reloaded string property names differ from original");
                 System.err.println("\toriginal: " + pps[i].stringPropertyNames());
                 System.err.println("\treloaded: " + pps[i+1].stringPropertyNames());
-                throw new RuntimeException(m.displayName() +": P" + (i/2+1)
+                throw new RuntimeException("P" + (i/2+1)
                         + " Reloaded string property names differ from original");
             }
         }
--- a/jdk/test/java/util/Properties/MyXmlPropertiesProvider.java	Mon May 12 12:35:23 2014 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-import java.util.*;
-import java.io.*;
-
-public class MyXmlPropertiesProvider
-    extends sun.util.spi.XmlPropertiesProvider
-{
-    private static int createCount;
-    private static int loadCount;
-    private static int storeCount;
-
-    static int createCount() { return createCount; }
-    static int loadCount() { return loadCount; }
-    static int storeCount() { return storeCount; }
-
-    public MyXmlPropertiesProvider() {
-        createCount++;
-    }
-
-    @Override
-    public void load(Properties props, InputStream in)
-        throws IOException, InvalidPropertiesFormatException
-    {
-        loadCount++;
-    }
-
-    @Override
-    public void store(Properties props, OutputStream out,
-                      String comment, String encoding)
-        throws IOException
-    {
-        storeCount++;
-    }
-}