8213325: (props) Properties.loadFromXML does not fully comply with the spec
authorjoehw
Tue, 04 Dec 2018 14:53:00 -0800
changeset 52825 2077a5437d43
parent 52824 52a692760109
child 52826 c0f40bca91a5
8213325: (props) Properties.loadFromXML does not fully comply with the spec Reviewed-by: alanb, rriggs, dfuchs, naoto
src/java.base/share/classes/jdk/internal/org/xml/sax/DTDHandler.java
src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java
src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java
src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java
test/jdk/java/util/Properties/Compatibility.xml
test/jdk/java/util/Properties/CompatibilityTest.java
test/jdk/java/util/Properties/invalidxml/IllegalElement.xml
test/jdk/java/util/Properties/invalidxml/invalidDTD.xml
test/jdk/java/util/ResourceBundle/Control/XmlRB.xml
test/jdk/java/util/ResourceBundle/Control/XmlRB_ja.xml
test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources.xml
test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_de.xml
test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_en.xml
test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_fr.xml
test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_ja.xml
test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh.xml
test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh_TW.xml
test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml
test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB_ja.xml
--- a/src/java.base/share/classes/jdk/internal/org/xml/sax/DTDHandler.java	Tue Dec 04 15:22:41 2018 -0500
+++ b/src/java.base/share/classes/jdk/internal/org/xml/sax/DTDHandler.java	Tue Dec 04 14:53:00 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, 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
@@ -73,7 +73,6 @@
  */
 public interface DTDHandler {
 
-
     /**
      * Receive notification of a notation declaration event.
      *
@@ -136,6 +135,39 @@
                                              String notationName)
         throws SAXException;
 
+    // from SAX2 extension DeclHandler
+    /**
+     * Receive notification of the start of DTD declarations.
+     *
+     * The start/endDTD events appear within the start/endDocument events
+     * from ContentHandler.
+     *
+     * @param name The document type name.
+     * @param publicId The declared public identifier for the
+     *        external DTD subset, or null if none was declared.
+     * @param systemId The declared system identifier for the
+     *        external DTD subset, or null if none was declared.
+     *        (Note that this is not resolved against the document
+     *        base URI.)
+     * @throws SAXException the event receiver may throw an exception during processing
+     */
+    default public void startDTD (String name, String publicId, String systemId)
+        throws SAXException
+    {
+        // no op
+    }
+
+    // Custom API for the Properties
+
+    /**
+     * Receive notification of the start of DTD internal subset.
+     *
+     * @throws SAXException the event receiver may throw an exception during processing
+     */
+    default public void startInternalSub () throws SAXException
+    {
+        // no op
+    }
 }
 
 // end of DTDHandler.java
--- a/src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java	Tue Dec 04 15:22:41 2018 -0500
+++ b/src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java	Tue Dec 04 14:53:00 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -54,11 +54,11 @@
     private static final String ATTR_KEY = "key";
     // The required DTD URI for exported properties
     private static final String PROPS_DTD_DECL =
-            "<!DOCTYPE properties SYSTEM \"http://java.sun.com/dtd/properties.dtd\">";
+        "<!DOCTYPE properties SYSTEM \"http://java.sun.com/dtd/properties.dtd\">";
     private static final String PROPS_DTD_URI =
-            "http://java.sun.com/dtd/properties.dtd";
+        "http://java.sun.com/dtd/properties.dtd";
     private static final String PROPS_DTD =
-            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
             + "<!-- DTD for properties -->"
             + "<!ELEMENT properties ( comment?, entry* ) >"
             + "<!ATTLIST properties"
@@ -136,15 +136,15 @@
     ////////////////////////////////////////////////////////////////////
     // Validate while parsing
     ////////////////////////////////////////////////////////////////////
-    static final String ALLOWED_ELEMENTS = "properties, comment, entry";
+    static final String ALLOWED_ELEMENTS = "comment, entry";
     static final String ALLOWED_COMMENT = "comment";
     ////////////////////////////////////////////////////////////////////
     // Handler methods
     ////////////////////////////////////////////////////////////////////
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
+    boolean sawRoot = false; // whether a valid root element exists
     boolean sawComment = false;
     boolean validEntry = false;
-    int rootElem = 0;
     String key;
     String rootElm;
 
@@ -152,32 +152,38 @@
     public void startElement(String uri, String localName, String qName, Attributes attributes)
         throws SAXException
     {
-        if (rootElem < 2) {
-            rootElem++;
+        if (sawRoot) {
+            if (!ALLOWED_ELEMENTS.contains(qName)) {
+                fatalError(new SAXParseException("Element type \"" + qName + "\" must be declared.", null));
+            }
+        } else {
+            // check whether the root has been declared in the DTD
+            if (rootElm == null) {
+                fatalError(new SAXParseException("An XML properties document must contain"
+                    + " the DOCTYPE declaration as defined by java.util.Properties.", null));
+            }
+
+            // check whether the element name matches the declaration
+            if (!rootElm.equals(qName)) {
+                fatalError(new SAXParseException("Document root element \"" + qName
+                    + "\", must match DOCTYPE root \"" + rootElm + "\"", null));
+            }
+
+            // this is a valid root element
+            sawRoot = true;
         }
 
-        if (rootElm == null) {
-            fatalError(new SAXParseException("An XML properties document must contain"
-                    + " the DOCTYPE declaration as defined by java.util.Properties.", null));
-        }
-
-        if (rootElem == 1 && !rootElm.equals(qName)) {
-            fatalError(new SAXParseException("Document root element \"" + qName
-                    + "\", must match DOCTYPE root \"" + rootElm + "\"", null));
-        }
-        if (!ALLOWED_ELEMENTS.contains(qName)) {
-            fatalError(new SAXParseException("Element type \"" + qName + "\" must be declared.", null));
-        }
         if (qName.equals(ELEMENT_ENTRY)) {
             validEntry = true;
             key = attributes.getValue(ATTR_KEY);
             if (key == null) {
-                fatalError(new SAXParseException("Attribute \"key\" is required and must be specified for element type \"entry\"", null));
+                fatalError(new SAXParseException("Attribute \"key\" is required and " +
+                    "must be specified for element type \"entry\"", null));
             }
         } else if (qName.equals(ALLOWED_COMMENT)) {
             if (sawComment) {
                 fatalError(new SAXParseException("Only one comment element may be allowed. "
-                        + "The content of element type \"properties\" must match \"(comment?,entry*)\"", null));
+                    + "The content of element type \"properties\" must match \"(comment?,entry*)\"", null));
             }
             sawComment = true;
         }
@@ -192,8 +198,9 @@
 
     @Override
     public void endElement(String uri, String localName, String qName) throws SAXException {
-        if (!ALLOWED_ELEMENTS.contains(qName)) {
-            fatalError(new SAXParseException("Element: " + qName + " is invalid, must match  \"(comment?,entry*)\".", null));
+        if (!ALLOWED_ELEMENTS.contains(qName) && !ELEMENT_ROOT.equals(qName)) {
+            fatalError(new SAXParseException("Element: " + qName +
+                " is invalid, must match  \"(comment?,entry*)\".", null));
         }
 
         if (validEntry) {
@@ -204,19 +211,12 @@
     }
 
     @Override
-    public void notationDecl(String name, String publicId, String systemId) throws SAXException {
-        rootElm = name;
-    }
-
-    @Override
     public InputSource resolveEntity(String pubid, String sysid)
-            throws SAXException, IOException {
+        throws SAXException, IOException {
         {
             if (sysid.equals(PROPS_DTD_URI)) {
-                InputSource is;
-                is = new InputSource(new StringReader(PROPS_DTD));
-                is.setSystemId(PROPS_DTD_URI);
-                return is;
+                // The properties DTD is known to the handler, no need to parse it
+                return null;
             }
             throw new SAXException("Invalid system identifier: " + sysid);
         }
@@ -236,4 +236,24 @@
     public void warning(SAXParseException x) throws SAXException {
         throw x;
     }
+
+    // SAX2 extension from DTDHandler
+
+    @Override
+    public void startDTD (String name, String publicId, String systemId) throws SAXException
+    {
+        if (!ELEMENT_ROOT.equals(name) || !PROPS_DTD_URI.equals(systemId)) {
+            fatalError(new SAXParseException("An XML properties document must contain"
+                + " the DOCTYPE declaration as defined by java.util.Properties.", null));
+        }
+        rootElm = name;
+    }
+
+    @Override
+    public void startInternalSub () throws SAXException
+    {
+        fatalError(new SAXParseException("Internal DTD subset is not allowed. " +
+            "The Properties XML document must have the following DOCTYPE declaration: \n" +
+            PROPS_DTD_DECL, null));
+    }
 }
--- a/src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java	Tue Dec 04 15:22:41 2018 -0500
+++ b/src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java	Tue Dec 04 14:53:00 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -650,6 +650,8 @@
      * @exception IOException
      */
     private void dtdsub() throws Exception {
+        startInternalSub(); // reports the event before parsing the subset
+
         char ch;
         for (short st = 0; st >= 0;) {
             ch = getch();
@@ -2231,6 +2233,13 @@
             throws SAXException;
 
     /**
+     * Reports the start of DTD internal subset.
+     *
+     * @throws SAXException if the receiver throws SAXException
+     */
+    public abstract void startInternalSub () throws SAXException;
+
+    /**
      * Reports a comment.
      *
      * @param text The comment text starting from first charcater.
--- a/src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java	Tue Dec 04 15:22:41 2018 -0500
+++ b/src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java	Tue Dec 04 14:53:00 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -551,7 +551,16 @@
      * @param sysid The system identifier of the entity or <code>null</code>.
      */
     protected void docType(String name, String pubid, String sysid) throws SAXException {
-        mHandDtd.notationDecl(name, pubid, sysid);
+        mHandDtd.startDTD(name, pubid, sysid);
+    }
+
+    /**
+     * Reports the start of DTD internal subset.
+     *
+     * @throws SAXException if the receiver throws SAXException
+     */
+    public void startInternalSub () throws SAXException {
+        mHandDtd.startInternalSub();
     }
 
     /**
--- a/test/jdk/java/util/Properties/Compatibility.xml	Tue Dec 04 15:22:41 2018 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd" 
- [<!ENTITY intEnt 'value3'> ]>
-<?PITarget PIContent?>
-<properties>
-<comment>Property With Other Encoding</comment>
-<entry key="Key1">value1</entry>
-<entry key="Key2"><![CDATA[<value2>]]></entry>
-<entry key="Key3">&intEnt;</entry>
-</properties>
--- a/test/jdk/java/util/Properties/CompatibilityTest.java	Tue Dec 04 15:22:41 2018 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +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 8005280 8004371
- * @summary Compatibility test
- */
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-/**
- * This is a behavior compatibility test.
- * Although not defined by the properties.dtd, the constructs
- * in Compatibility.xml are supported by the regular JDK XML
- * Provider.
- *
- * @author: Joe Wang
- */
-public class CompatibilityTest {
-
-    public static void main(String[] args) {
-        testInternalDTD();
-    }
-
-    /*
-     * Not in the spec, but the constructs work with the current JDK
-     */
-    static void testInternalDTD() {
-        String src = System.getProperty("test.src");
-        if (src == null) {
-            src = ".";
-        }
-        loadPropertyFile(src + "/Compatibility.xml");
-    }
-
-    /*
-     * 'Store' the populated 'Property' with the specified 'Encoding Type' as an
-     * XML file. Retrieve the same XML file and 'load' onto a new 'Property' object.
-     */
-    static void loadPropertyFile(String filename) {
-        try (InputStream in = new FileInputStream(filename)) {
-            Properties prop = new Properties();
-            prop.loadFromXML(in);
-            verifyProperites(prop);
-        } catch (IOException ex) {
-            fail(ex.getMessage());
-        }
-    }
-
-    /*
-     * This method verifies the first key-value with the original string.
-     */
-    static void verifyProperites(Properties prop) {
-        try {
-            for (String key : prop.stringPropertyNames()) {
-                String val = prop.getProperty(key);
-                if (key.equals("Key1")) {
-                    if (!val.equals("value1")) {
-                        fail("Key:" + key + "'s value: \nExpected: value1\nFound: " + val);
-                    }
-                } else if (key.equals("Key2")) {
-                    if (!val.equals("<value2>")) {
-                        fail("Key:" + key + "'s value: \nExpected: <value2>\nFound: " + val);
-                    }
-                } else if (key.equals("Key3")) {
-                    if (!val.equals("value3")) {
-                        fail("Key:" + key + "'s value: \nExpected: value3\nFound: " + val);
-                    }
-                }
-            }
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
-
-    }
-
-    static void fail(String err) {
-        throw new RuntimeException(err);
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/Properties/invalidxml/IllegalElement.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf8" standalone="no"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<!-- The dtd requires a properties root, but not element -->
+
+<properties>
+<comment>comment</comment>
+    <properties>
+        <entry key="firstKey">value of the first key</entry>
+    </properties>
+</properties>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/Properties/invalidxml/invalidDTD.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd" 
+ [<!ENTITY intEnt 'value3'> ]>
+<?PITarget PIContent?>
+<properties>
+<comment>Property With Other Encoding</comment>
+<entry key="Key1">value1</entry>
+<entry key="Key2"><![CDATA[<value2>]]></entry>
+<entry key="Key3">&intEnt;</entry>
+</properties>
--- a/test/jdk/java/util/ResourceBundle/Control/XmlRB.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/ResourceBundle/Control/XmlRB.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -2,15 +2,7 @@
 
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for XMLResourceBundleTest.java</comment>
     <entry key="type">XML</entry>
--- a/test/jdk/java/util/ResourceBundle/Control/XmlRB_ja.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/ResourceBundle/Control/XmlRB_ja.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -2,15 +2,7 @@
 
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for XMLResourceBundleTest.java</comment>
     <entry key="type">XML</entry>
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -2,15 +2,7 @@
 
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for ResourceBundle</comment>
     <entry key="key">root: message</entry>
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_de.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_de.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -2,15 +2,7 @@
 
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for ResourceBundle</comment>
     <entry key="key">de: message</entry>
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_en.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_en.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -2,15 +2,7 @@
 
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for ResourceBundle</comment>
     <entry key="key">en: message</entry>
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_fr.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_fr.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -2,15 +2,7 @@
 
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for ResourceBundle</comment>
     <entry key="key">fr: message</entry>
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_ja.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_ja.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -2,15 +2,7 @@
 
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for ResourceBundle in named modules.</comment>
     <entry key="key">ja: message</entry>
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -2,15 +2,7 @@
 
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for ResourceBundle in named modules.</comment>
     <entry key="key">zh: message</entry>
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh_TW.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh_TW.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -2,15 +2,7 @@
 
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for ResourceBundle in named modules.</comment>
     <entry key="key">zh-TW: message</entry>
--- a/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -23,15 +23,7 @@
 -->
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for UserDefaultControlTest.java</comment>
     <entry key="type">XML</entry>
--- a/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB_ja.xml	Tue Dec 04 15:22:41 2018 -0500
+++ b/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB_ja.xml	Tue Dec 04 14:53:00 2018 -0800
@@ -23,15 +23,7 @@
 -->
 <!---->
 
-<!-- DTD for properties -->
-<!DOCTYPE properties [
-<!ELEMENT properties ( comment?, entry* ) >
-<!ATTLIST properties version CDATA #FIXED "1.0">
-<!ELEMENT comment (#PCDATA) >
-<!ELEMENT entry (#PCDATA) >
-<!ATTLIST entry key CDATA #REQUIRED>
-]>
-
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 <properties>
     <comment>Test data for UserDefaultControlTest.java</comment>
     <entry key="type">XML</entry>