Skip to content

Commit 1c1f7a1

Browse files
committed
8210722: JAXP Tests: CatalogSupport2 and CatalogSupport3 generate incorrect messages upon failure
Backport-of: fad3c52
1 parent 8138382 commit 1c1f7a1

16 files changed

+42
-36
lines changed

test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
33
<!-- DTDs and external entities -->
4-
<system systemId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
4+
<system systemId="http://openjdk_java_net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
55

66
<!-- XMLSchema refers to XMLSchema.dtd -->
77
<public publicId="-//W3C//DTD XMLSCHEMA 200102//EN" uri="XMLSchema.dtd"/>
@@ -35,8 +35,8 @@
3535
<system systemId="pathto/XSLInclude_header.xsl" uri="XSLInclude_header.xsl"/>
3636
<system systemId="pathto/XSLInclude_footer.xsl" uri="XSLInclude_footer.xsl"/>
3737
<!-- and DTDs -->
38-
<system systemId="http://openjdk.java.net/xml/catalog/dtd/XSLDTD.dtd" uri="XSLDTD.dtd"/>
39-
<system systemId="http://openjdk.java.net/xml/catalog/dtd/include.dtd" uri="include.dtd"/>
38+
<system systemId="http://openjdk_java_net/xml/catalog/dtd/XSLDTD.dtd" uri="XSLDTD.dtd"/>
39+
<system systemId="http://openjdk_java_net/xml/catalog/dtd/include.dtd" uri="include.dtd"/>
4040

4141
<!-- XSLT document function -->
4242
<system systemId="pathto/DocFunc2.xml" uri="DocFuncCatalog.xml"/>

test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -81,6 +81,7 @@ public class CatalogSupport2 extends CatalogSupportBase {
8181
public void setUpClass() throws Exception {
8282
setUp();
8383
setSystemProperty(SP_USE_CATALOG, "false");
84+
setSystemProperty(SP_ACCESS_EXTERNAL_DTD, "file");
8485
timeoutRead = getSystemProperty(TTIMEOUTREAD);
8586
timeoutConnect = getSystemProperty(TIMEOUTCONNECT);
8687
setSystemProperty(TTIMEOUTREAD, "1000");
@@ -90,14 +91,15 @@ public void setUpClass() throws Exception {
9091
@AfterClass
9192
public void tearDownClass() throws Exception {
9293
clearSystemProperty(SP_USE_CATALOG);
94+
clearSystemProperty(SP_ACCESS_EXTERNAL_DTD);
9395
setSystemProperty(TIMEOUTCONNECT, "-1");
9496
setSystemProperty(TTIMEOUTREAD, "-1");
9597
}
9698

9799
/*
98100
Verifies the Catalog support on SAXParser.
99101
*/
100-
@Test(dataProvider = "data_SAXC", expectedExceptions = IOException.class)
102+
@Test(dataProvider = "data_SAXC", expectedExceptions = SAXParseException.class)
101103
public void testSAXC(boolean setUseCatalog, boolean useCatalog, String catalog, String
102104
xml, MyHandler handler, String expected) throws Exception {
103105
testSAX(setUseCatalog, useCatalog, catalog, xml, handler, expected);
@@ -106,7 +108,7 @@ public void testSAXC(boolean setUseCatalog, boolean useCatalog, String catalog,
106108
/*
107109
Verifies the Catalog support on XMLReader.
108110
*/
109-
@Test(dataProvider = "data_SAXC", expectedExceptions = IOException.class)
111+
@Test(dataProvider = "data_SAXC", expectedExceptions = SAXParseException.class)
110112
public void testXMLReaderC(boolean setUseCatalog, boolean useCatalog, String catalog,
111113
String xml, MyHandler handler, String expected) throws Exception {
112114
testXMLReader(setUseCatalog, useCatalog, catalog, xml, handler, expected);
@@ -124,7 +126,7 @@ public void testXIncludeC(boolean setUseCatalog, boolean useCatalog, String cata
124126
/*
125127
Verifies the Catalog support on DOM parser.
126128
*/
127-
@Test(dataProvider = "data_DOMC", expectedExceptions = IOException.class)
129+
@Test(dataProvider = "data_DOMC", expectedExceptions = SAXParseException.class)
128130
public void testDOMC(boolean setUseCatalog, boolean useCatalog, String catalog,
129131
String xml, MyHandler handler, String expected) throws Exception {
130132
testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
@@ -133,7 +135,7 @@ public void testDOMC(boolean setUseCatalog, boolean useCatalog, String catalog,
133135
/*
134136
Verifies the Catalog support on XMLStreamReader.
135137
*/
136-
@Test(dataProvider = "data_StAXC")
138+
@Test(dataProvider = "data_StAXC", expectedExceptions = XMLStreamException.class)
137139
public void testStAXC(boolean setUseCatalog, boolean useCatalog, String catalog,
138140
String xml, XMLResolver resolver, String expected) throws Exception {
139141
testStAXNegative(setUseCatalog, useCatalog, catalog, xml, resolver, expected);

test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
2323

2424
package catalog;
2525

26+
import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
2627
import static jaxp.library.JAXPTestUtilities.getSystemProperty;
2728
import static jaxp.library.JAXPTestUtilities.setSystemProperty;
2829

@@ -82,18 +83,20 @@ public void setUpClass() throws Exception {
8283
timeoutConnect = getSystemProperty(TIMEOUTCONNECT);
8384
setSystemProperty(TTIMEOUTREAD, "1000");
8485
setSystemProperty(TIMEOUTCONNECT, "1000");
86+
setSystemProperty(SP_ACCESS_EXTERNAL_DTD, "file");
8587
}
8688

8789
@AfterClass
8890
public void tearDownClass() throws Exception {
8991
setSystemProperty(TIMEOUTCONNECT, "-1");
9092
setSystemProperty(TTIMEOUTREAD, "-1");
93+
clearSystemProperty(SP_ACCESS_EXTERNAL_DTD);
9194
}
9295

9396
/*
9497
Verifies the Catalog support on SAXParser.
9598
*/
96-
@Test(dataProvider = "data_SAXC", expectedExceptions = IOException.class)
99+
@Test(dataProvider = "data_SAXC", expectedExceptions = SAXParseException.class)
97100
public void testSAXC(boolean setUseCatalog, boolean useCatalog, String catalog,
98101
String xml, MyHandler handler, String expected) throws Exception {
99102
testSAX(setUseCatalog, useCatalog, catalog, xml, handler, expected);
@@ -102,7 +105,7 @@ public void testSAXC(boolean setUseCatalog, boolean useCatalog, String catalog,
102105
/*
103106
Verifies the Catalog support on XMLReader.
104107
*/
105-
@Test(dataProvider = "data_SAXC", expectedExceptions = IOException.class)
108+
@Test(dataProvider = "data_SAXC", expectedExceptions = SAXParseException.class)
106109
public void testXMLReaderC(boolean setUseCatalog, boolean useCatalog, String catalog,
107110
String xml, MyHandler handler, String expected) throws Exception {
108111
testXMLReader(setUseCatalog, useCatalog, catalog, xml, handler, expected);
@@ -120,7 +123,7 @@ public void testXIncludeC(boolean setUseCatalog, boolean useCatalog, String cata
120123
/*
121124
Verifies the Catalog support on DOM parser.
122125
*/
123-
@Test(dataProvider = "data_DOMC", expectedExceptions = IOException.class)
126+
@Test(dataProvider = "data_DOMC", expectedExceptions = SAXParseException.class)
124127
public void testDOMC(boolean setUseCatalog, boolean useCatalog, String catalog,
125128
String xml, MyHandler handler, String expected) throws Exception {
126129
testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
@@ -129,7 +132,7 @@ public void testDOMC(boolean setUseCatalog, boolean useCatalog, String catalog,
129132
/*
130133
Verifies the Catalog support on XMLStreamReader.
131134
*/
132-
@Test(dataProvider = "data_StAXC")
135+
@Test(dataProvider = "data_StAXC", expectedExceptions = XMLStreamException.class)
133136
public void testStAXC(boolean setUseCatalog, boolean useCatalog, String catalog,
134137
String xml, XMLResolver resolver, String expected) throws Exception {
135138
testStAXNegative(setUseCatalog, useCatalog, catalog, xml, resolver, expected);

test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -90,6 +90,7 @@
9090
public class CatalogSupportBase {
9191
// the System Property for the USE_CATALOG feature
9292
final static String SP_USE_CATALOG = "javax.xml.useCatalog";
93+
final static String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD";
9394

9495
boolean debug = false;
9596

@@ -232,7 +233,7 @@ void initFiles() {
232233
+ ""
233234
+ "</xsl:stylesheet>";
234235
xsl_includeDTD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
235-
+ "<!DOCTYPE HTMLlat1 SYSTEM \"http://openjdk.java.net/xml/catalog/dtd/XSLDTD.dtd\">"
236+
+ "<!DOCTYPE HTMLlat1 SYSTEM \"http://openjdk_java_net/xml/catalog/dtd/XSLDTD.dtd\">"
236237
+ "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">"
237238
+ " <xsl:import href=\"pathto/XSLImport_html.xsl\"/>"
238239
+ " <xsl:include href=\"pathto/XSLInclude_header.xsl\"/>"
@@ -262,7 +263,7 @@ void initFiles() {
262263
"</content>";
263264

264265
xml_xslDTD = "<?xml version=\"1.0\"?>\n" +
265-
"<!DOCTYPE content SYSTEM \"http://openjdk.java.net/xml/catalog/dtd/include.dtd\">" +
266+
"<!DOCTYPE content SYSTEM \"http://openjdk_java_net/xml/catalog/dtd/include.dtd\">" +
266267
"<content>\n" +
267268
" <header>This is the header</header>\n" +
268269
" Some content\n" +

test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogSupport_uri.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
33
<!-- DTDs and external entities -->
4-
<uri name="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
4+
<uri name="http://openjdk_java_net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
55

66
<!-- XMLSchema refers to XMLSchema.dtd -->
77
<public publicId="-//W3C//DTD XMLSCHEMA 200102//EN" uri="XMLSchema.dtd"/>
@@ -34,8 +34,8 @@
3434
<uri name="pathto/XSLInclude_header.xsl" uri="XSLInclude_header.xsl"/>
3535
<uri name="pathto/XSLInclude_footer.xsl" uri="XSLInclude_footer.xsl"/>
3636
<!-- and DTDs -->
37-
<uri name="http://openjdk.java.net/xml/catalog/dtd/XSLDTD.dtd" uri="XSLDTD.dtd"/>
38-
<uri name="http://openjdk.java.net/xml/catalog/dtd/include.dtd" uri="include.dtd"/>
37+
<uri name="http://openjdk_java_net/xml/catalog/dtd/XSLDTD.dtd" uri="XSLDTD.dtd"/>
38+
<uri name="http://openjdk_java_net/xml/catalog/dtd/include.dtd" uri="include.dtd"/>
3939

4040
<!-- XSLT document function -->
4141
<uri name="pathto/DocFunc2.xml" uri="DocFuncCatalog.xml"/>

test/jaxp/javax/xml/jaxp/unittest/catalog/CatalogTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -654,7 +654,7 @@ public Object[][] getDataForMatchingBothIds() {
654654
};
655655
}
656656

657-
static String id = "http://openjdk.java.net/xml/catalog/dtd/system.dtd";
657+
static String id = "http://openjdk_java_net/xml/catalog/dtd/system.dtd";
658658
/*
659659
DataProvider: used to verify how prefer settings affect the result of the
660660
Catalog's matching operation.

test/jaxp/javax/xml/jaxp/unittest/catalog/catalog.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
uri="file:///share/mirrors/w3c/xhtml1/xhtml1-strict.dtd"/>
1010

1111
<public publicId="-//OPENJDK//XML CATALOG DTD//1.0" uri="public.dtd"/>
12-
<system systemId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
12+
<system systemId="http://openjdk_java_net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
1313

14-
<rewriteSystem systemIdStartString="http://openjdk.java.net/"
14+
<rewriteSystem systemIdStartString="http://openjdk_java_net/"
1515
rewritePrefix="files" />
1616

17-
<rewriteSystem systemIdStartString="http://openjdk.java.net/xml/catalog/dtd/"
17+
<rewriteSystem systemIdStartString="http://openjdk_java_net/xml/catalog/dtd/"
1818
rewritePrefix="files" />
1919

2020
<systemSuffix systemIdSuffix="systemsuffix.dtd" uri="systemsuffix.dtd"/>

test/jaxp/javax/xml/jaxp/unittest/catalog/catalog_uri.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
44

55
<!-- using uri entries -->
6-
<uri name="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
7-
<rewriteURI uriStartString="http://openjdk.java.net/"
6+
<uri name="http://openjdk_java_net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
7+
<rewriteURI uriStartString="http://openjdk_java_net/"
88
rewritePrefix="files" />
99

10-
<rewriteURI uriStartString="http://openjdk.java.net/xml/catalog/dtd/"
10+
<rewriteURI uriStartString="http://openjdk_java_net/xml/catalog/dtd/"
1111
rewritePrefix="files" />
1212

1313
<uriSuffix uriSuffix="systemsuffix.dtd" uri="systemsuffix.dtd"/>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
33

4-
<public publicId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="public.dtd"/>
4+
<public publicId="http://openjdk_java_net/xml/catalog/dtd/system.dtd" uri="public.dtd"/>
55

66
</catalog>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE catalogtest PUBLIC "-//OPENJDK//XML CATALOG DTD//REWRITE"
3-
"http://openjdk.java.net/xml/catalog/dtd/rewritesystem.dtd">
3+
"http://openjdk_java_net/xml/catalog/dtd/rewritesystem.dtd">
44

55
<catalogtest>Test &rewritesystem; entry</catalogtest>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE catalogtest PUBLIC "-//OPENJDK//XML CATALOG DTD//REWRITE"
3-
"http://openjdk.java.net/rewritesystem.dtd">
3+
"http://openjdk_java_net/rewritesystem.dtd">
44

55
<catalogtest>Test &rewritesystem; entry</catalogtest>
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
33

4-
<system systemId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
5-
<public publicId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="public.dtd"/>
4+
<system systemId="http://openjdk_java_net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
5+
<public publicId="http://openjdk_java_net/xml/catalog/dtd/system.dtd" uri="public.dtd"/>
66

77
</catalog>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
33

4-
<system systemId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
4+
<system systemId="http://openjdk_java_net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
55

66
</catalog>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE catalogtest PUBLIC "-//OPENJDK//XML CATALOG DTD SYSTEM//1.0"
3-
"http://openjdk.java.net/xml/catalog/dtd/system.dtd">
3+
"http://openjdk_java_net/xml/catalog/dtd/system.dtd">
44

55
<catalogtest>Test &system; entry</catalogtest>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE catalogtest PUBLIC "-//OPENJDK//XML CATALOG DTD//REWRITE"
3-
"http://openjdk.java.net/xml/catalog/dtd/systemsuffix.dtd">
3+
"http://openjdk_java_net/xml/catalog/dtd/systemsuffix.dtd">
44

55
<catalogtest>Test &systemsuffix; entry</catalogtest>

test/jaxp/javax/xml/jaxp/unittest/catalog/val_test.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.1"?>
22
<!DOCTYPE catalogtest PUBLIC "-//OPENJDK//XML CATALOG DTD//1.0"
3-
"http://openjdk.java.net/xml/catalog/dtd/system.dtd">
3+
"http://openjdk_java_net/xml/catalog/dtd/system.dtd">
44
<test:root xmlns:test="test"
55
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66
xsi:schemaLocation="test pathto/val_test.xsd"

0 commit comments

Comments
 (0)