mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-13 15:09:39 +00:00
8150969: DEFER from Features API is taking precedence over defer preference in catalog file
Reviewed-by: lancea
This commit is contained in:
parent
871832c718
commit
88deed35ed
@ -186,7 +186,7 @@ class CatalogReader extends DefaultHandler implements EntityResolver, URIResolve
|
||||
}
|
||||
//override property settings with those from the catalog file
|
||||
catalog.setResolve(resolve);
|
||||
catalog.setPrefer(defer);
|
||||
catalog.setDeferred(defer);
|
||||
catalogEntry = new CatalogEntry(base, prefer, defer, resolve);
|
||||
} else {
|
||||
catalogEntry = new CatalogEntry(base, prefer);
|
||||
|
||||
@ -24,6 +24,7 @@ package catalog;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.xml.catalog.Catalog;
|
||||
import javax.xml.catalog.CatalogException;
|
||||
import javax.xml.catalog.CatalogFeatures;
|
||||
import javax.xml.catalog.CatalogFeatures.Feature;
|
||||
import javax.xml.catalog.CatalogManager;
|
||||
@ -42,10 +43,28 @@ import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.ext.DefaultHandler2;
|
||||
|
||||
/*
|
||||
* @bug 8081248, 8144966, 8146606, 8146237, 8151154
|
||||
* @bug 8081248, 8144966, 8146606, 8146237, 8151154, 8150969
|
||||
* @summary Tests basic Catalog functions.
|
||||
*/
|
||||
public class CatalogTest {
|
||||
/**
|
||||
* @bug 8150969
|
||||
* Verifies that the defer attribute set in the catalog file takes precedence
|
||||
* over other settings, in which case, whether next and delegate Catalogs will
|
||||
* be loaded is determined by the defer attribute.
|
||||
*/
|
||||
@Test(dataProvider = "invalidAltCatalogs", expectedExceptions = CatalogException.class)
|
||||
public void testDeferAltCatalogs(String file) {
|
||||
String catalogFile = getClass().getResource(file).getFile();
|
||||
CatalogFeatures features = CatalogFeatures.builder().with(CatalogFeatures.Feature.DEFER, "true").build();
|
||||
/*
|
||||
Since the defer attribute is set to false in the specified catalog file,
|
||||
the parent catalog will try to load the alt catalog, which will fail
|
||||
since it points to an invalid catalog.
|
||||
*/
|
||||
Catalog catalog = CatalogManager.catalog(features, catalogFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* @bug 8151154
|
||||
* Verifies that the CatalogFeatures' builder throws IllegalArgumentException
|
||||
@ -213,6 +232,18 @@ public class CatalogTest {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DataProvider: catalogs that contain invalid next or delegate catalogs.
|
||||
The defer attribute is set to false.
|
||||
*/
|
||||
@DataProvider(name = "invalidAltCatalogs")
|
||||
Object[][] getCatalogs() {
|
||||
return new Object[][]{
|
||||
{"defer_false_2.xml"},
|
||||
{"defer_del_false.xml"}
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
DataProvider: for testing the verification of file paths by
|
||||
the CatalogFeatures builder
|
||||
|
||||
4
jaxp/test/javax/xml/jaxp/unittest/catalog/bad_cat.xml
Normal file
4
jaxp/test/javax/xml/jaxp/unittest/catalog/bad_cat.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
|
||||
<public
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" defer="false">
|
||||
<delegatePublic publicIdStartString="DELEGATE-DEFER" catalog="bad_cat.xml"/>
|
||||
<!--<nextCatalog catalog="file_cat.xml"/>-->
|
||||
</catalog>
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" defer="false">
|
||||
<nextCatalog catalog="bad_cat.xml"/>
|
||||
<!--<nextCatalog catalog="file_cat.xml"/>-->
|
||||
</catalog>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user