diff --git a/src/java.base/share/classes/jdk/internal/org/xml/sax/DTDHandler.java b/src/java.base/share/classes/jdk/internal/org/xml/sax/DTDHandler.java
index 6e004ef5e54..3c2a5e939ae 100644
--- a/src/java.base/share/classes/jdk/internal/org/xml/sax/DTDHandler.java
+++ b/src/java.base/share/classes/jdk/internal/org/xml/sax/DTDHandler.java
@@ -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 @@ package jdk.internal.org.xml.sax;
*/
public interface DTDHandler {
-
/**
* Receive notification of a notation declaration event.
*
@@ -136,6 +135,39 @@ public interface DTDHandler {
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
diff --git a/src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java b/src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java
index b72deaccbee..ff4d9ea17c8 100644
--- a/src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java
+++ b/src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java
@@ -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 @@ public class PropertiesDefaultHandler extends DefaultHandler {
private static final String ATTR_KEY = "key";
// The required DTD URI for exported properties
private static final String PROPS_DTD_DECL =
- "";
+ "";
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 =
- ""
+ ""
+ ""
+ ""
+ "= 0;) {
ch = getch();
@@ -2230,6 +2232,13 @@ public abstract class Parser {
protected abstract void docType(String name, String pubid, String sysid)
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.
*
diff --git a/src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java b/src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java
index 412a686129c..a208ee84e6c 100644
--- a/src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java
+++ b/src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java
@@ -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 @@ final class ParserSAX
* @param sysid The system identifier of the entity or null.
*/
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();
}
/**
diff --git a/test/jdk/java/util/Properties/CompatibilityTest.java b/test/jdk/java/util/Properties/CompatibilityTest.java
deleted file mode 100644
index 46d8a10c92c..00000000000
--- a/test/jdk/java/util/Properties/CompatibilityTest.java
+++ /dev/null
@@ -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("")) {
- fail("Key:" + key + "'s value: \nExpected: \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);
- }
-
-}
diff --git a/test/jdk/java/util/Properties/invalidxml/IllegalElement.xml b/test/jdk/java/util/Properties/invalidxml/IllegalElement.xml
new file mode 100644
index 00000000000..e09d4d2ab9d
--- /dev/null
+++ b/test/jdk/java/util/Properties/invalidxml/IllegalElement.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+comment
+
+ value of the first key
+
+
diff --git a/test/jdk/java/util/Properties/Compatibility.xml b/test/jdk/java/util/Properties/invalidxml/invalidDTD.xml
similarity index 100%
rename from test/jdk/java/util/Properties/Compatibility.xml
rename to test/jdk/java/util/Properties/invalidxml/invalidDTD.xml
diff --git a/test/jdk/java/util/ResourceBundle/Control/XmlRB.xml b/test/jdk/java/util/ResourceBundle/Control/XmlRB.xml
index a96efe144c6..15a0a1534c9 100644
--- a/test/jdk/java/util/ResourceBundle/Control/XmlRB.xml
+++ b/test/jdk/java/util/ResourceBundle/Control/XmlRB.xml
@@ -2,15 +2,7 @@
-
-
-
-
-
-
-]>
-
+
Test data for XMLResourceBundleTest.java
XML
diff --git a/test/jdk/java/util/ResourceBundle/Control/XmlRB_ja.xml b/test/jdk/java/util/ResourceBundle/Control/XmlRB_ja.xml
index 2dc7dc5828c..91511d31336 100644
--- a/test/jdk/java/util/ResourceBundle/Control/XmlRB_ja.xml
+++ b/test/jdk/java/util/ResourceBundle/Control/XmlRB_ja.xml
@@ -2,15 +2,7 @@
-
-
-
-
-
-
-]>
-
+
Test data for XMLResourceBundleTest.java
XML
diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources.xml b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources.xml
index dc4be6b78c3..5f8609ebcb4 100644
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources.xml
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources.xml
@@ -2,15 +2,7 @@
-
-
-
-
-
-
-]>
-
+
Test data for ResourceBundle
root: message
diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_de.xml b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_de.xml
index cfaa5dda5a1..44e869f98f1 100644
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_de.xml
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_de.xml
@@ -2,15 +2,7 @@
-
-
-
-
-
-
-]>
-
+
Test data for ResourceBundle
de: message
diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_en.xml b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_en.xml
index 0213a2126ba..9a828dab28a 100644
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_en.xml
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_en.xml
@@ -2,15 +2,7 @@
-
-
-
-
-
-
-]>
-
+
Test data for ResourceBundle
en: message
diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_fr.xml b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_fr.xml
index d6b57efc7cf..e7a5c40620d 100644
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_fr.xml
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_fr.xml
@@ -2,15 +2,7 @@
-
-
-
-
-
-
-]>
-
+
Test data for ResourceBundle
fr: message
diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_ja.xml b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_ja.xml
index 6d82961e83d..cf102c1c859 100644
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_ja.xml
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_ja.xml
@@ -2,15 +2,7 @@
-
-
-
-
-
-
-]>
-
+
Test data for ResourceBundle in named modules.
ja: message
diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh.xml b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh.xml
index df1a2b727d6..fae6c5b126d 100644
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh.xml
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh.xml
@@ -2,15 +2,7 @@
-
-
-
-
-
-
-]>
-
+
Test data for ResourceBundle in named modules.
zh: message
diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh_TW.xml b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh_TW.xml
index 5ce424a187c..adc0d667233 100644
--- a/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh_TW.xml
+++ b/test/jdk/java/util/ResourceBundle/modules/basic/srcXml/bundles/jdk/test/resources/MyResources_zh_TW.xml
@@ -2,15 +2,7 @@
-
-
-
-
-
-
-]>
-
+
Test data for ResourceBundle in named modules.
zh-TW: message
diff --git a/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml b/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml
index cae776ebe4d..ea2256edf73 100644
--- a/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml
+++ b/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB.xml
@@ -23,15 +23,7 @@
-->
-
-
-
-
-
-
-]>
-
+
Test data for UserDefaultControlTest.java
XML
diff --git a/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB_ja.xml b/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB_ja.xml
index 646725e8955..71a220f2ffc 100644
--- a/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB_ja.xml
+++ b/test/jdk/java/util/spi/ResourceBundleControlProvider/com/foo/XmlRB_ja.xml
@@ -23,15 +23,7 @@
-->
-
-
-
-
-
-
-]>
-
+
Test data for UserDefaultControlTest.java
XML