--- old/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java 2016-04-06 12:16:15.733734463 -0700 +++ new/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java 2016-04-06 12:16:15.589727308 -0700 @@ -24,6 +24,7 @@ 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,11 +43,29 @@ 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 * on invalid file inputs. @@ -214,6 +233,18 @@ } /* + 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 */