--- old/test/ProblemList.txt 2016-07-18 00:49:35.787072771 -0700 +++ new/test/ProblemList.txt 2016-07-18 00:49:35.665133772 -0700 @@ -28,3 +28,7 @@ javax/xml/jaxp/unittest/common/TransformationWarningsTest.java 8150145 generic-all javax/xml/jaxp/unittest/stream/FactoryFindTest.java 8156508 generic-all + +javax/xml/jaxp/unittest/catalog/CatalogTest.java 8161176 generic-all + +javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java 8161454 generic-all --- old/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java 2016-07-18 00:49:36.228851771 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java 2016-07-18 00:49:36.101915271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -28,6 +28,7 @@ import javax.xml.catalog.CatalogException; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -39,6 +40,7 @@ * This case tests if the implementation handles this issue. * @compile ../../libs/catalog/CatalogTestUtils.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class CatalogReferCircularityTest { @Test(dataProvider = "catalogName", --- old/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java 2016-07-18 00:49:36.658636771 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java 2016-07-18 00:49:36.537697272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -29,6 +29,7 @@ import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -36,6 +37,7 @@ * @bug 8077931 * @summary This case tests if the default feature values are expected. */ +@Listeners({jaxp.library.FilePolicy.class}) public class DefaultFeaturesTest { private CatalogFeatures defaultFeature; --- old/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java 2016-07-18 00:49:37.077427272 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java 2016-07-18 00:49:36.960485772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -36,6 +36,7 @@ import org.testng.Assert; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -46,6 +47,7 @@ * in resolution via defer feature. * @compile ../../libs/catalog/CatalogTestUtils.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class DeferFeatureTest { @Test(dataProvider = "catalog-countOfLoadedCatalogFile") --- old/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java 2016-07-18 00:49:37.530200772 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java 2016-07-18 00:49:37.411260271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -40,6 +41,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class DelegatePublicTest { @Test(dataProvider = "publicId-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java 2016-07-18 00:49:37.955987772 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java 2016-07-18 00:49:37.832049772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -40,6 +41,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class DelegateSystemTest { @Test(dataProvider = "systemId-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java 2016-07-18 00:49:38.387771771 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java 2016-07-18 00:49:38.265832772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.catalog.CatalogUriResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -40,6 +41,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class DelegateUriTest { @Test(dataProvider = "uri-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/GroupTest.java 2016-07-18 00:49:38.974478272 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/GroupTest.java 2016-07-18 00:49:38.772579272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -42,6 +43,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class GroupTest { private static final String CATALOG_GROUP = "group.xml"; --- old/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java 2016-07-18 00:49:39.404263271 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java 2016-07-18 00:49:39.286322272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -36,6 +36,7 @@ import javax.xml.catalog.CatalogUriResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -47,6 +48,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class LoadCatalogTest { private static final String CATALOG_LOADCATALOGFILES = "loadCatalogFiles.xml"; --- old/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java 2016-07-18 00:49:39.835047772 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java 2016-07-18 00:49:39.711109772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.catalog.CatalogUriResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -43,6 +44,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class NextCatalogTest { private static final String CATALOG_NEXTCATALOGLEFT --- old/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java 2016-07-18 00:49:40.266831771 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java 2016-07-18 00:49:40.145892271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.catalog.CatalogUriResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -45,6 +46,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class NormalizationTest { private static final String CATALOG_NORMALIZATION = "normalization.xml"; --- old/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java 2016-07-18 00:49:40.707611272 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java 2016-07-18 00:49:40.583673272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -43,6 +44,7 @@ * in catalog file. * @compile ../../libs/catalog/CatalogTestUtils.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class PreferFeatureTest { @Test(dataProvider = "prefer-publicId-systemId", --- old/test/javax/xml/jaxp/functional/catalog/PreferTest.java 2016-07-18 00:49:41.155387272 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/PreferTest.java 2016-07-18 00:49:41.031449272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -41,6 +42,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class PreferTest { @Test(dataProvider = "publicId-systemId-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java 2016-07-18 00:49:41.638145772 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java 2016-07-18 00:49:41.482223772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.catalog.CatalogException; import javax.xml.catalog.CatalogResolver; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -42,6 +43,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class PublicFamilyTest { /* --- old/test/javax/xml/jaxp/functional/catalog/PublicTest.java 2016-07-18 00:49:42.153887772 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/PublicTest.java 2016-07-18 00:49:42.006961272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -41,6 +42,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class PublicTest { @Test(dataProvider = "publicId-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java 2016-07-18 00:49:42.639644771 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java 2016-07-18 00:49:42.500714272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -40,6 +40,7 @@ import javax.xml.catalog.CatalogResolver; import javax.xml.catalog.CatalogUriResolver; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -50,6 +51,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class ResolveFeatureTest { /* --- old/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java 2016-07-18 00:49:43.166381272 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java 2016-07-18 00:49:43.021453771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -40,6 +41,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class RewriteSystemTest { @Test(dataProvider = "systemId-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java 2016-07-18 00:49:43.601163771 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java 2016-07-18 00:49:43.479224772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.catalog.CatalogUriResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -40,6 +41,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class RewriteUriTest { @Test(dataProvider = "uri-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java 2016-07-18 00:49:44.042942771 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java 2016-07-18 00:49:43.913007772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -36,6 +36,7 @@ import javax.xml.catalog.CatalogResolver; import javax.xml.catalog.CatalogUriResolver; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -45,6 +46,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class SpecifyCatalogTest { private static final String ID_URI = "http://remote/dtd/uri/doc.dtd"; --- old/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java 2016-07-18 00:49:44.475726272 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java 2016-07-18 00:49:44.356785771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -43,6 +44,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class SystemFamilyTest { @Test(dataProvider = "systemId-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java 2016-07-18 00:49:44.908509771 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java 2016-07-18 00:49:44.787570271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -40,6 +41,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class SystemSuffixTest { @Test(dataProvider = "systemId-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/SystemTest.java 2016-07-18 00:49:45.343292271 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/SystemTest.java 2016-07-18 00:49:45.221353272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -41,6 +42,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class SystemTest { @Test(dataProvider = "systemId-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java 2016-07-18 00:49:45.768079771 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java 2016-07-18 00:49:45.649139271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.catalog.CatalogUriResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -43,6 +44,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class UriFamilyTest { @Test(dataProvider = "uri-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java 2016-07-18 00:49:46.208859271 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java 2016-07-18 00:49:46.076925271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.catalog.CatalogUriResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -40,6 +41,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class UriSuffixTest { @Test(dataProvider = "uri-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/UriTest.java 2016-07-18 00:49:46.647639772 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/UriTest.java 2016-07-18 00:49:46.526700271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -34,6 +34,7 @@ import javax.xml.catalog.CatalogUriResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -43,6 +44,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class UriTest { @Test(dataProvider = "uri-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java 2016-07-18 00:49:47.088419271 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java 2016-07-18 00:49:46.968479271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.catalog.CatalogResolver; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -40,6 +41,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class UrnUnwrappingTest { @Test(dataProvider = "urn-matchedUri") --- old/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java 2016-07-18 00:49:47.547189772 -0700 +++ new/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java 2016-07-18 00:49:47.425250771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.catalog.CatalogException; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -43,6 +44,7 @@ * @compile ../../libs/catalog/CatalogTestUtils.java * @compile ../../libs/catalog/ResolutionChecker.java */ +@Listeners({jaxp.library.FilePolicy.class}) public class ValidateCatalogTest { private static final String CATALOG_WRONGROOT = "validateCatalog-wrongRoot.xml"; --- old/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java 2016-07-18 00:49:47.998963771 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java 2016-07-18 00:49:47.871027772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -44,17 +44,17 @@ import javax.xml.datatype.Duration; import javax.xml.namespace.QName; -import jaxp.library.JAXPBaseTest; - import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Class containing the test cases for Duration. */ -public class DurationTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class DurationTest { private DatatypeFactory datatypeFactory; --- old/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java 2016-07-18 00:49:48.457734271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java 2016-07-18 00:49:48.324800771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -30,15 +30,16 @@ import javax.xml.datatype.Duration; import jaxp.library.JAXPDataProvider; -import jaxp.library.JAXPBaseTest; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Tests for DatatypeFactory.newInstance(factoryClassName , classLoader) */ -public class FactoryNewInstanceTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class FactoryNewInstanceTest { private static final String DATATYPE_FACTORY_CLASSNAME = "com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl"; --- old/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java 2016-07-18 00:49:48.914505772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java 2016-07-18 00:49:48.780572771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -39,18 +39,18 @@ import javax.xml.datatype.Duration; import javax.xml.datatype.XMLGregorianCalendar; -import jaxp.library.JAXPBaseTest; - import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 5049592 5041845 5048932 5064587 5040542 5049531 5049528 * @summary Class containing the test cases for XMLGregorianCalendar */ -public class XMLGregorianCalendarTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class XMLGregorianCalendarTest { private DatatypeFactory datatypeFactory; --- old/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java 2016-07-18 00:49:49.367279272 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java 2016-07-18 00:49:49.233346272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -23,18 +23,21 @@ package javax.xml.parsers.ptests; +import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR; +import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR; import static jaxp.library.JAXPTestUtilities.USER_DIR; import static jaxp.library.JAXPTestUtilities.compareWithGold; import static org.testng.Assert.assertTrue; + import java.io.File; + import javax.xml.parsers.DocumentBuilderFactory; -import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR; -import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; -import jaxp.library.JAXPFileBaseTest; + import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -42,7 +45,8 @@ * This tests DocumentBuilderFactory for namespace processing and no-namespace * processing. */ -public class DBFNamespaceTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class DBFNamespaceTest { /** * Provide input for the cases that supporting namespace or not. --- old/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java 2016-07-18 00:49:49.817054271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java 2016-07-18 00:49:49.689118272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -40,7 +40,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FilePermission; import java.io.FileReader; import javax.xml.parsers.DocumentBuilder; @@ -55,9 +54,9 @@ import javax.xml.transform.sax.SAXResult; import jaxp.library.JAXPDataProvider; -import jaxp.library.JAXPFileBaseTest; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -70,7 +69,8 @@ * @bug 8080907 * This checks the methods of DocumentBuilderFactoryImpl. */ -public class DocumentBuilderFactoryTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class DocumentBuilderFactoryTest { /** * DocumentBuilderFactory implementation class name. */ @@ -419,8 +419,6 @@ @Test public void testCheckDocumentBuilderFactory13() throws Exception { // Accesing default working directory. - String workingDir = getSystemProperty("user.dir"); - setPermissions(new FilePermission(workingDir + "/*", "read")); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document doc = docBuilder.parse(new File(XML_DIR + "dbf10import.xsl") @@ -436,8 +434,6 @@ @Test(expectedExceptions = SAXException.class) public void testCheckDocumentBuilderFactory14() throws Exception { // Accesing default working directory. - String workingDir = getSystemProperty("user.dir"); - setPermissions(new FilePermission(workingDir, "read")); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); docBuilder.parse(""); --- old/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java 2016-07-18 00:49:50.264830271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java 2016-07-18 00:49:50.137893772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -23,18 +23,21 @@ package javax.xml.parsers.ptests; +import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR; import static jaxp.library.JAXPTestUtilities.FILE_SEP; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; + import java.io.File; import java.io.FileInputStream; import java.io.FilePermission; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR; -import jaxp.library.JAXPFileReadOnlyBaseTest; -import static org.testng.Assert.assertNotNull; + import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; @@ -42,8 +45,8 @@ /** * This checks for the methods of DocumentBuilder */ -public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest - implements EntityResolver { +@Listeners({jaxp.library.FilePolicy.class}) +public class DocumentBuilderImpl01 implements EntityResolver { /** * Provide DocumentBuilder. * @@ -82,7 +85,7 @@ * @param docBuilder document builder instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider") + @Test(dataProvider = "builder-provider") public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder) throws Exception { try (FileInputStream fis = new FileInputStream(new File(XML_DIR, @@ -97,7 +100,7 @@ * @param docBuilder document builder instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider") + @Test(dataProvider = "builder-provider") public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder) throws Exception { assertNotNull(docBuilder.parse(new File(XML_DIR, @@ -109,11 +112,9 @@ * @param docBuilder document builder instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider") + @Test(dataProvider = "builder-provider") public void testCheckDocumentBuilderImpl06(DocumentBuilder docBuilder) throws Exception { - setPermissions(new FilePermission(XML_DIR + "../-", - "read")); try (FileInputStream fis = new FileInputStream(new File(XML_DIR, "DocumentBuilderImpl02.xml"))) { assertNotNull(docBuilder.parse(fis, new File(XML_DIR).toURI() --- old/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java 2016-07-18 00:49:50.702611271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java 2016-07-18 00:49:50.580672272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -26,17 +26,18 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPBaseTest; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /** * Class containing the test cases for SAXParserFactory/DocumentBuilderFactory * newInstance methods. */ -public class FactoryConfErrorTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class FactoryConfErrorTest { /** * Set properties DocumentBuilderFactory and SAXParserFactory to invalid @@ -44,8 +45,8 @@ */ @BeforeTest public void setup() { - setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", "xx"); - setSystemProperty("javax.xml.parsers.SAXParserFactory", "xx"); + System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "xx"); + System.setProperty("javax.xml.parsers.SAXParserFactory", "xx"); } /** @@ -54,8 +55,8 @@ */ @AfterTest public void cleanup() { - setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", null); - setSystemProperty("javax.xml.parsers.SAXParserFactory", null); + System.clearProperty("javax.xml.parsers.DocumentBuilderFactory"); + System.clearProperty("javax.xml.parsers.SAXParserFactory"); } /** --- old/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java 2016-07-18 00:49:51.145389771 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java 2016-07-18 00:49:51.018453271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -31,16 +31,17 @@ import javax.xml.parsers.SAXParserFactory; import jaxp.library.JAXPDataProvider; -import jaxp.library.JAXPBaseTest; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; /* * @summary Tests for SAXParserFactory.newInstance(factoryClassName , classLoader) */ -public class SAXFactoryNewInstanceTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class SAXFactoryNewInstanceTest { private static final String SAXPARSER_FACTORY_CLASSNAME = "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"; --- old/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java 2016-07-18 00:49:51.580172271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java 2016-07-18 00:49:51.462231272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -24,14 +24,17 @@ package javax.xml.parsers.ptests; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; + import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPBaseTest; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /** * Class containing the test cases for SAXParserFactory API. */ -public class SAXParserFactTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class SAXParserFactTest { private static final String NAMESPACES = "http://xml.org/sax/features/namespaces"; private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes"; --- old/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java 2016-07-18 00:49:52.042940772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java 2016-07-18 00:49:51.919002771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -23,15 +23,20 @@ package javax.xml.parsers.ptests; +import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR; + import java.io.File; import java.io.FileInputStream; import java.io.FilePermission; import java.io.IOException; + import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR; -import jaxp.library.JAXPFileReadOnlyBaseTest; + +import jaxp.library.JAXPTestUtilities; + import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.HandlerBase; import org.xml.sax.InputSource; @@ -41,7 +46,8 @@ /** * Class contains the test cases for SAXParser API */ -public class SAXParserTest extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class SAXParserTest { /** * Provide SAXParser. * @@ -92,13 +98,7 @@ @Test(expectedExceptions = { SAXException.class }, dataProvider = "parser-provider") public void testParse03(SAXParser saxparser) throws Exception { - String workingDir = getSystemProperty("user.dir"); - setPermissions(new FilePermission(workingDir, "read")); - try { - saxparser.parse("", new HandlerBase()); - } finally { - setPermissions(); - } + saxparser.parse("", new HandlerBase()); } /** @@ -124,13 +124,7 @@ */ @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider") public void testParse05(SAXParser saxparser) throws Exception { - String workingDir = getSystemProperty("user.dir"); - setPermissions(new FilePermission(workingDir, "read")); - try { - saxparser.parse(new File(""), new HandlerBase()); - } finally { - setPermissions(); - } + saxparser.parse(new File(""), new HandlerBase()); } /** @@ -176,23 +170,18 @@ } /** - * Test with non-existence URI, parsing should fail and throw - * SAXException or IOException. + * Test with non-existence URI, parsing should fail and throw SAXException + * or IOException. * - * @param saxparser a SAXParser instance. - * @throws Exception If any errors occur. + * @param saxparser + * a SAXParser instance. + * @throws Exception + * If any errors occur. */ - @Test(expectedExceptions = { SAXException.class, IOException.class }, - dataProvider = "parser-provider") + @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider") public void testParse09(SAXParser saxparser) throws Exception { - String workingDir = getSystemProperty("user.dir"); - setPermissions(new FilePermission(workingDir + "/../-", "read")); - String uri = " "; - try { - saxparser.parse(uri, new DefaultHandler()); - } finally { - setPermissions(); - } + JAXPTestUtilities.tryRunWithTmpPermission(() -> saxparser.parse(" ", new DefaultHandler()), + new FilePermission(System.getProperty("user.dir") + "/ ", "read")); } /** @@ -204,14 +193,8 @@ */ @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider") public void testParse10(SAXParser saxparser) throws Exception { - String workingDir = getSystemProperty("user.dir"); - setPermissions(new FilePermission(workingDir, "read")); File file = new File(""); - try { - saxparser.parse(file, new DefaultHandler()); - } finally { - setPermissions(); - } + saxparser.parse(file, new DefaultHandler()); } /** @@ -248,7 +231,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class, + @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider") public void testParse13(SAXParser saxparser) throws Exception { try (FileInputStream instream = new FileInputStream(new File( @@ -263,7 +246,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse14(SAXParser saxparser) throws Exception { saxparser.parse(new File(XML_DIR, "parsertest.xml"), new HandlerBase()); @@ -276,7 +259,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse15(SAXParser saxparser) throws Exception { try (FileInputStream instream = new FileInputStream(new File(XML_DIR, "correct.xml"))) { @@ -291,7 +274,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse16(SAXParser saxparser) throws Exception { try (FileInputStream instream = new FileInputStream( new File(XML_DIR, "parsertest.xml"))) { @@ -306,7 +289,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse17(SAXParser saxparser) throws Exception { File file = new File(XML_DIR, "correct.xml"); saxparser.parse(file.toURI().toASCIIString(), new HandlerBase()); @@ -319,7 +302,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class, + @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider") public void testParse18(SAXParser saxparser) throws Exception { saxparser.parse(new File(XML_DIR, "valid.xml"), new HandlerBase()); @@ -332,7 +315,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse19(SAXParser saxparser) throws Exception { saxparser.parse(new File(XML_DIR, "correct.xml"), new HandlerBase()); } @@ -344,7 +327,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class, + @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider") public void testParse20(SAXParser saxparser) throws Exception { try(FileInputStream instream = new FileInputStream(new File(XML_DIR, @@ -360,7 +343,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse21(SAXParser saxparser) throws Exception { try (FileInputStream instream = new FileInputStream(new File(XML_DIR, "correct.xml"))) { @@ -375,7 +358,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class, + @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider") public void testParse22(SAXParser saxparser) throws Exception { try (FileInputStream instream = new FileInputStream( @@ -391,7 +374,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse23(SAXParser saxparser) throws Exception { DefaultHandler handler = new DefaultHandler(); saxparser.parse(new File(XML_DIR, "parsertest.xml"), handler); @@ -404,7 +387,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse24(SAXParser saxparser) throws Exception { try (FileInputStream instream = new FileInputStream(new File(XML_DIR, "correct.xml"))) { @@ -420,7 +403,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse25(SAXParser saxparser) throws Exception { try (FileInputStream instream = new FileInputStream( new File(XML_DIR, "parsertest.xml"))) { @@ -435,7 +418,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse26(SAXParser saxparser) throws Exception { File file = new File(XML_DIR, "correct.xml"); saxparser.parse(file.toURI().toASCIIString(), new DefaultHandler()); @@ -448,7 +431,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class, + @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider") public void testParse27(SAXParser saxparser) throws Exception { saxparser.parse(new File(XML_DIR, "valid.xml"), new DefaultHandler()); @@ -461,7 +444,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse28(SAXParser saxparser) throws Exception { saxparser.parse(new File(XML_DIR, "correct.xml"), new DefaultHandler()); } @@ -472,7 +455,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class, + @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider") public void testParse29(SAXParser saxparser) throws Exception { try (FileInputStream instream = new FileInputStream( @@ -487,7 +470,7 @@ * @param saxparser a SAXParser instance. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider") + @Test(dataProvider = "parser-provider") public void testParse30(SAXParser saxparser) throws Exception { try (FileInputStream instream = new FileInputStream( new File(XML_DIR, "correct.xml"))) { @@ -500,7 +483,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testParse31() throws Exception { try (FileInputStream instream = new FileInputStream( new File(XML_DIR, "ns4.xml"))) { --- old/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java 2016-07-18 00:49:52.617653272 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java 2016-07-18 00:49:52.406758771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -24,13 +24,15 @@ package javax.xml.parsers.ptests; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; + import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPBaseTest; -import static org.testng.Assert.assertNotNull; + import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; import org.xml.sax.SAXNotSupportedException; @@ -40,7 +42,8 @@ /** * Class contains the test cases for SAXParser API */ -public class SAXParserTest02 extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class SAXParserTest02 { private static final String DOM_NODE = "http://xml.org/sax/properties/dom-node"; private static final String XML_STRING = "http://xml.org/sax/properties/xml-string"; private static final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler"; --- old/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java 2016-07-18 00:49:53.161381271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java 2016-07-18 00:49:53.017453272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -23,25 +23,26 @@ package javax.xml.parsers.ptests; +import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; + import java.io.File; -import java.io.FilePermission; + import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR; -import jaxp.library.JAXPFileReadOnlyBaseTest; -import static org.testng.Assert.fail; -import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; + import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; /** * Class contains the test cases for SAXParser API */ -public class SAXParserTest03 extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class SAXParserTest03 { /** * Provide SAXParserFactory. @@ -63,7 +64,7 @@ * @param handler an error handler for capturing events. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider") + @Test(dataProvider = "input-provider") public void testParseValidate01(SAXParserFactory spf, MyErrorHandler handler) throws Exception { spf.newSAXParser().parse(new File(XML_DIR, "parsertest.xml"), handler); @@ -78,7 +79,7 @@ * @param handler an error handler for capturing events. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider") + @Test(dataProvider = "input-provider") public void testParseValidate02(SAXParserFactory spf, MyErrorHandler handler) throws Exception { spf.setNamespaceAware(true); @@ -95,7 +96,7 @@ * @param handler an error handler for capturing events. * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider") + @Test(dataProvider = "input-provider") public void testParseValidate03(SAXParserFactory spf, MyErrorHandler handler) throws Exception { try { --- old/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java 2016-07-18 00:49:53.644139772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java 2016-07-18 00:49:53.513205272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -28,15 +28,16 @@ import javax.xml.stream.XMLEventFactory; import jaxp.library.JAXPDataProvider; -import jaxp.library.JAXPBaseTest; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Tests for XMLEventFactory.newFactory(factoryId , classLoader) */ -public class XMLEventFactoryNewInstanceTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class XMLEventFactoryNewInstanceTest { private static final String XMLEVENT_FACTORY_CLASSNAME = "com.sun.xml.internal.stream.events.XMLEventFactoryImpl"; private static final String XMLEVENT_FACRORY_ID = "javax.xml.stream.XMLEventFactory"; @@ -54,12 +55,12 @@ */ @Test(dataProvider = "parameters") public void testNewFactory(String factoryId, ClassLoader classLoader) { - setSystemProperty(XMLEVENT_FACRORY_ID, XMLEVENT_FACTORY_CLASSNAME); + System.setProperty(XMLEVENT_FACRORY_ID, XMLEVENT_FACTORY_CLASSNAME); try { XMLEventFactory xef = XMLEventFactory.newFactory(factoryId, classLoader); assertNotNull(xef); } finally { - setSystemProperty(XMLEVENT_FACRORY_ID, null); + System.clearProperty(XMLEVENT_FACRORY_ID); } } --- old/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java 2016-07-18 00:49:54.080921271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java 2016-07-18 00:49:53.953984772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -28,15 +28,16 @@ import javax.xml.stream.XMLInputFactory; import jaxp.library.JAXPDataProvider; -import jaxp.library.JAXPBaseTest; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Tests for XMLInputFactory.newFactory(factoryId , classLoader) */ -public class XMLInputFactoryNewInstanceTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class XMLInputFactoryNewInstanceTest { private static final String XMLINPUT_FACTORY_CLASSNAME = "com.sun.xml.internal.stream.XMLInputFactoryImpl"; private static final String XMLINPUT_FACRORY_ID = "javax.xml.stream.XMLInputFactory"; @@ -54,12 +55,12 @@ */ @Test(dataProvider = "parameters") public void testNewFactory(String factoryId, ClassLoader classLoader) { - setSystemProperty(XMLINPUT_FACRORY_ID, XMLINPUT_FACTORY_CLASSNAME); + System.setProperty(XMLINPUT_FACRORY_ID, XMLINPUT_FACTORY_CLASSNAME); try { XMLInputFactory xif = XMLInputFactory.newFactory(factoryId, classLoader); assertNotNull(xif); } finally { - setSystemProperty(XMLINPUT_FACRORY_ID, null); + System.clearProperty(XMLINPUT_FACRORY_ID); } } --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java 2016-07-18 00:49:54.513704771 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java 2016-07-18 00:49:54.388767271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -23,6 +23,8 @@ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; + import java.io.ByteArrayOutputStream; import java.io.File; @@ -34,9 +36,7 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileBaseTest; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -44,7 +44,8 @@ * @bug 6384418 * @summary verify the transforming won't throw any exception */ -public class Bug6384418Test extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class Bug6384418Test { @Test public void test() throws Exception { --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java 2016-07-18 00:49:54.957482771 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java 2016-07-18 00:49:54.826548271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -23,20 +23,23 @@ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareWithGold; +import static org.testng.Assert.assertTrue; + import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; + import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMResult; -import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareWithGold; -import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; @@ -50,7 +53,8 @@ * DOM parse on test file to be compared with golden output file. No Exception * is expected. */ -public class DOMResultTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class DOMResultTest { /** * Unit test for simple DOM parsing. * @throws Exception If any errors occur. --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java 2016-07-18 00:49:55.394264271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java 2016-07-18 00:49:55.269326771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -23,23 +23,26 @@ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + import java.io.File; -import java.io.FilePermission; + import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPBaseTest; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /** * Class containing the test cases for ErrorListener interface */ -public class ErrorListenerTest extends JAXPBaseTest implements ErrorListener { +@Listeners({jaxp.library.FilePolicy.class}) +public class ErrorListenerTest implements ErrorListener { /** * Define ErrorListener's status. */ @@ -60,7 +63,6 @@ try { TransformerFactory tfactory = TransformerFactory.newInstance(); tfactory.setErrorListener (listener); - setPermissions(new FilePermission(XML_DIR + "invalid.xsl", "read")); tfactory.newTransformer(new StreamSource( new File(XML_DIR + "invalid.xsl"))); fail("Expect TransformerConfigurationException here"); --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java 2016-07-18 00:49:55.857032772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java 2016-07-18 00:49:55.722100271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -23,18 +23,21 @@ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; + import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.dom.DOMSource; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileReadOnlyBaseTest; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; @@ -42,7 +45,8 @@ /** * Unit test for SAXSource sourceToInputSource API. */ -public class SAXSourceTest extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class SAXSourceTest { /** * Test style-sheet file name */ @@ -53,7 +57,7 @@ * * @throws IOException reading file error. */ - @Test(groups = {"readLocalFiles"}) + @Test public void source2inputsource01() throws IOException { try (FileInputStream fis = new FileInputStream(TEST_FILE)) { StreamSource streamSource = new StreamSource(fis); @@ -68,7 +72,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void source2inputsource02() throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); @@ -83,7 +87,7 @@ * * @throws IOException reading file error. */ - @Test(groups = {"readLocalFiles"}) + @Test public void source2inputsource03() throws IOException { String SYSTEM_ID = "file:///" + XML_DIR; try (FileInputStream fis = new FileInputStream(TEST_FILE)) { --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java 2016-07-18 00:49:56.319801271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java 2016-07-18 00:49:56.189866272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -23,27 +23,30 @@ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareWithGold; +import static org.testng.Assert.assertTrue; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Result; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; -import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TemplatesHandler; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareWithGold; -import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -56,7 +59,8 @@ * Test newTransformerhandler() method which takes StreamSource as argument can * be set to XMLReader. */ -public class SAXTFactoryTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class SAXTFactoryTest { /** * Test style-sheet file. */ --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java 2016-07-18 00:49:56.787567271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java 2016-07-18 00:49:56.660630771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,11 +22,16 @@ */ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.failUnexpected; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Arrays; import java.util.Properties; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -34,12 +39,10 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.failUnexpected; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -48,7 +51,8 @@ * Test a StreamResult using a file name that contains URL characters that need * to be encoded. */ -public class StreamResultTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class StreamResultTest { /** * Unit test for StreamResult. */ --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java 2016-07-18 00:49:57.252334772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java 2016-07-18 00:49:57.107407272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,20 +22,23 @@ */ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNull; + import java.io.File; import java.io.FileInputStream; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileReadOnlyBaseTest; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -44,7 +47,8 @@ /** * Class containing the test cases for SAXParserFactory API */ -public class TfClearParamTest extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class TfClearParamTest { /** * Test style-sheet file name. */ @@ -128,7 +132,7 @@ * @throws TransformerConfigurationException If for some reason the * TransformerHandler can not be created. */ - @Test (groups = {"readLocalFiles"}) + @Test public void clear05() throws TransformerConfigurationException { Transformer transformer = TransformerFactory.newInstance(). newTransformer(new StreamSource(new File(XSL_FILE))); @@ -143,7 +147,7 @@ * @throws TransformerConfigurationException If for some reason the * TransformerHandler can not be created. */ - @Test (groups = {"readLocalFiles"}) + @Test public void clear06() throws TransformerConfigurationException { Transformer transformer = TransformerFactory.newInstance(). newTransformer(new StreamSource(new File(XSL_FILE))); @@ -157,7 +161,7 @@ * the a name that set before. Value should be same as set one. * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void clear07() throws Exception { try (FileInputStream fis = new FileInputStream(XSL_FILE)) { SAXSource saxSource = new SAXSource(); @@ -174,7 +178,7 @@ * the a name that wasn't set before. Null is expected. * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void clear08() throws Exception { try (FileInputStream fis = new FileInputStream(XSL_FILE)) { SAXSource saxSource = new SAXSource(); @@ -192,7 +196,7 @@ * the a name that set before. Value should be same as set one. * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void clear09() throws Exception { TransformerFactory tfactory = TransformerFactory.newInstance(); @@ -213,7 +217,7 @@ * the a name that wasn't set before. Null is expected. * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void clear10() throws Exception { TransformerFactory tfactory = TransformerFactory.newInstance(); --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java 2016-07-18 00:49:57.728096771 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java 2016-07-18 00:49:57.605158272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -38,7 +38,6 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; @@ -58,10 +57,9 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileBaseTest; - import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.Attributes; @@ -74,7 +72,8 @@ * @summary Tests for variable combination of Transformer.transform(Source, Result) */ @Test(singleThreaded = true) -public class TransformTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class TransformTest { /* * Initialize the share objects. --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java 2016-07-18 00:49:58.308806272 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java 2016-07-18 00:49:58.115902771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,32 +22,34 @@ */ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.fail; + import java.io.File; -import java.io.FilePermission; + import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPBaseTest; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.fail; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /** * Basic test for TransformerException specification. */ -public class TransformerExcpTest extends JAXPBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class TransformerExcpTest { /** * Transform an unformatted style-sheet file. TransformerException is thrown. */ @Test public void tfexception() { try { - setPermissions(new FilePermission(XML_DIR + "-", "read")); // invalid.xsl has well-formedness error. Therefore transform throws // TransformerException StreamSource streamSource @@ -63,8 +65,6 @@ assertNotNull(e.getException()); assertNull(e.getLocationAsString()); assertEquals(e.getMessageAndLocation(),e.getMessage()); - } finally { - setPermissions(); } } --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java 2016-07-18 00:49:58.983468772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java 2016-07-18 00:49:58.799560771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,33 +22,39 @@ */ package javax.xml.transform.ptests; -import java.io.*; - -import javax.xml.parsers.*; -import javax.xml.transform.*; -import javax.xml.transform.dom.*; - import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; - -import javax.xml.transform.stream.*; - -import jaxp.library.JAXPDataProvider; -import jaxp.library.JAXPFileBaseTest; import static jaxp.library.JAXPTestUtilities.USER_DIR; import static jaxp.library.JAXPTestUtilities.compareWithGold; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; +import java.io.FileInputStream; +import java.io.FileOutputStream; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import jaxp.library.JAXPDataProvider; + import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; -import org.w3c.dom.*; +import org.w3c.dom.Document; /** * Class containing the test cases for TransformerFactory API's * getAssociatedStyleSheet method and TransformerFactory.newInstance(factoryClassName , classLoader). */ -public class TransformerFactoryTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class TransformerFactoryTest { /** * TransformerFactory implementation class name. */ --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java 2016-07-18 00:49:59.631144772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java 2016-07-18 00:49:59.443238771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,9 +22,15 @@ */ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + import java.io.File; import java.io.FileInputStream; import java.util.Properties; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.ErrorListener; @@ -33,13 +39,10 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileReadOnlyBaseTest; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -47,7 +50,8 @@ /** * Basic test cases for Transformer API */ -public class TransformerTest extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class TransformerTest { /** * XSLT file serves every test method. */ @@ -58,7 +62,7 @@ * @throws TransformerConfigurationException If for some reason the * TransformerHandler can not be created. */ - @Test (groups = {"readLocalFiles"}) + @Test public void transformer01() throws TransformerConfigurationException { TransformerFactory tfactory = TransformerFactory.newInstance(); StreamSource streamSource = new StreamSource( @@ -71,7 +75,7 @@ * This tests if newTransformer(SAXSource) method returns Transformer. * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void transformer02() throws Exception { try (FileInputStream fis = new FileInputStream(TEST_XSL)) { TransformerFactory tfactory = TransformerFactory.newInstance(); @@ -86,7 +90,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void transformer03() throws Exception { TransformerFactory tfactory = TransformerFactory.newInstance(); @@ -105,7 +109,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void transformer04() throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); @@ -125,7 +129,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void transformer05() throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); @@ -150,7 +154,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void transformer06() throws Exception { TransformerFactory tfactory = TransformerFactory.newInstance(); --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java 2016-07-18 00:50:00.265827271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java 2016-07-18 00:50:00.105907271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,21 +22,24 @@ */ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareWithGold; +import static org.testng.Assert.assertTrue; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; + import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; -import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareWithGold; -import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; @@ -44,7 +47,8 @@ * Here a transformer is created using DOMSource. Some specific output property * is set on transformer. Then transform(StreamSource, StreamResult) is tested. */ -public class TransformerTest02 extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class TransformerTest02 { /** * Unit test for transform(StreamSource, StreamResult). * --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java 2016-07-18 00:50:00.850534772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java 2016-07-18 00:50:00.651634272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,22 +22,25 @@ */ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareWithGold; +import static org.testng.Assert.assertTrue; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Properties; + import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; -import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareWithGold; -import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /** @@ -46,7 +49,8 @@ * for transformer. Then transform(StreamSource, StreamResult) is used for * transformation. This tests the setOutputProperties() method. */ -public class TransformerTest03 extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class TransformerTest03 { /** * Test for Transformer.setOutputProperties method. * --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java 2016-07-18 00:50:01.330294772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java 2016-07-18 00:50:01.209355272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,8 +22,13 @@ */ package javax.xml.transform.ptests; +import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + import java.io.File; import java.io.FileInputStream; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Source; @@ -31,13 +36,11 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.URIResolver; import javax.xml.transform.dom.DOMSource; -import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileBaseTest; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -45,7 +48,8 @@ /** * URIResolver should be invoked when transform happens. */ -public class URIResolverTest extends JAXPFileBaseTest implements URIResolver { +@Listeners({jaxp.library.FilePolicy.class}) +public class URIResolverTest implements URIResolver { /** * System ID constant. */ @@ -115,7 +119,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public static void resolver01() throws Exception { try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)) { TransformerFactory tfactory = TransformerFactory.newInstance(); @@ -134,7 +138,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public static void resolver02() throws Exception { TransformerFactory tfactory = TransformerFactory.newInstance(); URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID); @@ -155,7 +159,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public static void resolver03() throws Exception { try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)){ URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID); @@ -174,7 +178,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public static void resolver04() throws Exception { try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)) { URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID); @@ -192,7 +196,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public static void resolver05() throws Exception { URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID); TransformerFactory tfactory = TransformerFactory.newInstance(); @@ -211,7 +215,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public static void resolver06() throws Exception { try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)){ URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID); @@ -230,7 +234,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public static void docResolver01() throws Exception { try (FileInputStream fis = new FileInputStream(XML_DIR + "doctest.xsl")) { URIResolverTest resolver = new URIResolverTest("temp/colors.xml", SYSTEM_ID); --- old/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java 2016-07-18 00:50:01.814052772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java 2016-07-18 00:50:01.678120772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -22,19 +22,23 @@ */ package javax.xml.transform.ptests.othervm; -import javax.xml.transform.*; -import jaxp.library.JAXPBaseTest; import static org.testng.Assert.fail; + +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /** * Negative test for set invalid TransformerFactory property. */ -public class TFCErrorTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class TFCErrorTest { @Test(expectedExceptions = ClassNotFoundException.class) public void tfce01() throws Exception { try{ - setSystemProperty("javax.xml.transform.TransformerFactory","xx"); + System.setProperty("javax.xml.transform.TransformerFactory","xx"); TransformerFactory.newInstance(); fail("Expect TransformerFactoryConfigurationError here"); } catch (TransformerFactoryConfigurationError expected) { --- old/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java 2016-07-18 00:50:02.276821272 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java 2016-07-18 00:50:02.153882772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 --- old/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java 2016-07-18 00:50:02.753582771 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java 2016-07-18 00:50:02.635641771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -39,8 +39,7 @@ import javax.xml.validation.TypeInfoProvider; import javax.xml.validation.ValidatorHandler; -import jaxp.library.JAXPFileBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.InputSource; @@ -51,7 +50,8 @@ /* * @summary test ValidatorHandler.getTypeInfoProvider() */ -public class TypeInfoProviderTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class TypeInfoProviderTest { private ValidatorHandler validatorHandler; --- old/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java 2016-07-18 00:50:03.227345772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java 2016-07-18 00:50:03.101408771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 --- old/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java 2016-07-18 00:50:03.687115771 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java 2016-07-18 00:50:03.561178771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -45,10 +45,9 @@ import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; -import jaxp.library.JAXPFileBaseTest; - import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.ErrorHandler; @@ -61,7 +60,8 @@ /* * @summary Class containing the test cases for Validator API */ -public class ValidatorTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class ValidatorTest { @BeforeClass public void setup() throws SAXException, IOException, ParserConfigurationException { --- old/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java 2016-07-18 00:50:04.174871772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java 2016-07-18 00:50:04.046935771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -23,26 +23,28 @@ package javax.xml.xpath.ptests; -import java.io.FilePermission; +import static javax.xml.xpath.XPathConstants.BOOLEAN; +import static javax.xml.xpath.XPathConstants.NODE; +import static javax.xml.xpath.XPathConstants.NODESET; +import static javax.xml.xpath.XPathConstants.NUMBER; +import static javax.xml.xpath.XPathConstants.STRING; +import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR; +import static org.testng.Assert.assertEquals; + import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; + import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; -import static javax.xml.xpath.XPathConstants.BOOLEAN; -import static javax.xml.xpath.XPathConstants.NODE; -import static javax.xml.xpath.XPathConstants.NODESET; -import static javax.xml.xpath.XPathConstants.NUMBER; -import static javax.xml.xpath.XPathConstants.STRING; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR; -import jaxp.library.JAXPFileReadOnlyBaseTest; -import static org.testng.Assert.assertEquals; + import org.testng.annotations.BeforeTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -52,7 +54,8 @@ /** * Class containing the test cases for XPathExpression API. */ -public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class XPathExpressionTest { /** * Document object for testing XML file. */ @@ -89,7 +92,6 @@ */ @BeforeTest public void setup() throws Exception { - setPermissions(new FilePermission(XML_PATH.toFile().toString(), "read")); document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile()); xpath = XPathFactory.newInstance().newXPath(); } @@ -264,7 +266,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression15() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.compile(EXPRESSION_NAME_A). @@ -287,7 +289,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void testCheckXPathExpression17() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(null).evaluate(new InputSource(is)); @@ -300,7 +302,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPathExpression18() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile("-*&").evaluate(new InputSource(is)); @@ -313,7 +315,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPathExpression19() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(" ").evaluate(new InputSource(is)); @@ -326,7 +328,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression20() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.compile(EXPRESSION_NAME_A). @@ -351,7 +353,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void testCheckXPathExpression22() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(null).evaluate(new InputSource(is), STRING); @@ -364,7 +366,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void testCheckXPathExpression23() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), null); @@ -377,7 +379,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPathExpression24() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile("-*&").evaluate(new InputSource(is), STRING); @@ -390,7 +392,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPathExpression25() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(" ").evaluate(new InputSource(is), STRING); @@ -404,7 +406,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class) + @Test(expectedExceptions = IllegalArgumentException.class) public void testCheckXPathExpression26() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), TEST_QNAME); @@ -417,7 +419,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression27() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.compile(EXPRESSION_NAME_A). @@ -431,7 +433,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression28() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.compile(EXPRESSION_NAME_B). @@ -445,7 +447,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression29() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.compile(EXPRESSION_NAME_A). @@ -459,7 +461,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression30() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A). @@ -474,7 +476,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression31() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A). --- old/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java 2016-07-18 00:50:04.619649272 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java 2016-07-18 00:50:04.493712272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -24,22 +24,23 @@ package javax.xml.xpath.ptests; import static javax.xml.xpath.XPathConstants.DOM_OBJECT_MODEL; +import static org.testng.Assert.assertNotNull; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathFactory; import javax.xml.xpath.XPathFactoryConfigurationException; import jaxp.library.JAXPDataProvider; -import jaxp.library.JAXPBaseTest; -import static org.testng.Assert.assertNotNull; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /** * Class containing the test cases for XPathFactory API. */ -public class XPathFactoryTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class XPathFactoryTest { /** * Valid URL for creating a XPath factory. */ --- old/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java 2016-07-18 00:50:05.088414771 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java 2016-07-18 00:50:04.967475271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -23,18 +23,21 @@ package javax.xml.xpath.ptests; +import static org.testng.Assert.assertEquals; + import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import jaxp.library.JAXPBaseTest; -import static org.testng.Assert.assertEquals; + import org.testng.annotations.BeforeTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /** * Class containing the test cases for XPathFunctionResolver. */ -public class XPathFunctionResolverTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class XPathFunctionResolverTest { /** * A XPath for evaluation environment and expressions. */ --- old/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java 2016-07-18 00:50:05.535191271 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java 2016-07-18 00:50:05.414251772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -23,30 +23,32 @@ package javax.xml.xpath.ptests; -import java.io.FilePermission; +import static javax.xml.xpath.XPathConstants.BOOLEAN; +import static javax.xml.xpath.XPathConstants.NODE; +import static javax.xml.xpath.XPathConstants.NODESET; +import static javax.xml.xpath.XPathConstants.NUMBER; +import static javax.xml.xpath.XPathConstants.STRING; +import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertNull; + import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Iterator; + import javax.xml.XMLConstants; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; -import static javax.xml.xpath.XPathConstants.BOOLEAN; -import static javax.xml.xpath.XPathConstants.NODE; -import static javax.xml.xpath.XPathConstants.NODESET; -import static javax.xml.xpath.XPathConstants.NUMBER; -import static javax.xml.xpath.XPathConstants.STRING; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR; -import jaxp.library.JAXPFileReadOnlyBaseTest; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertNull; + import org.testng.annotations.BeforeTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -56,7 +58,8 @@ /** * Class containing the test cases for XPath API. */ -public class XPathTest extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class XPathTest { /** * Document object for testing XML file. */ @@ -93,7 +96,6 @@ */ @BeforeTest public void setup() throws Exception { - setPermissions(new FilePermission(XML_DIR + "-", "read")); document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile()); xpath = XPathFactory.newInstance().newXPath(); } @@ -347,7 +349,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void testCheckXPath22() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is)), "6"); @@ -371,7 +373,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void testCheckXPath24() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.evaluate(null, new InputSource(is)); @@ -385,7 +387,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPath25() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.evaluate("-*&", new InputSource(is)); @@ -398,7 +400,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPath26() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.evaluate(" ", new InputSource(is)); @@ -411,7 +413,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPath27() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), STRING), "6"); @@ -435,7 +437,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void testCheckXPath29() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.evaluate(null, new InputSource(is), STRING); @@ -448,7 +450,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void testCheckXPath30() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), null); @@ -461,7 +463,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPath31() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.evaluate("-*&", new InputSource(is), STRING); @@ -474,7 +476,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPath32() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.evaluate(" ", new InputSource(is), STRING); @@ -488,7 +490,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class) + @Test(expectedExceptions = IllegalArgumentException.class) public void testCheckXPath33() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), TEST_QNAME); @@ -501,7 +503,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPath34() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), @@ -515,7 +517,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPath35() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is), @@ -529,7 +531,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPath36() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), @@ -543,7 +545,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPath37() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A, @@ -557,7 +559,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPath38() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A, @@ -573,7 +575,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPath52() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is), @@ -587,7 +589,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPath53() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), @@ -601,7 +603,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPath54() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A, @@ -615,7 +617,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPath55() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A, --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java 2016-07-18 00:50:05.989963772 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java 2016-07-18 00:50:05.868024772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,8 +31,6 @@ import javax.xml.parsers.ParserConfigurationException; -import jaxp.library.JAXPFileBaseTest; - import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import org.w3c.dom.CharacterData; @@ -42,7 +40,7 @@ /* * @summary common test for the CharacterData Interface */ -public abstract class AbstractCharacterDataTest extends JAXPFileBaseTest { +public abstract class AbstractCharacterDataTest { @DataProvider(name = "data-for-length") public Object[][] getDataForTestLength() { return new Object[][] { --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java 2016-07-18 00:50:06.416750272 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java 2016-07-18 00:50:06.298809272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -28,8 +28,8 @@ import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; import static org.w3c.dom.ptests.DOMTestUtil.createDOM; -import jaxp.library.JAXPFileBaseTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -40,7 +40,8 @@ /* * @summary Test for the Attr Interface */ -public class AttrTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class AttrTest { /* * Verify getName method against both existing Attr and new Attr. */ --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java 2016-07-18 00:50:06.856530271 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java 2016-07-18 00:50:06.737589771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -28,6 +28,7 @@ import javax.xml.parsers.ParserConfigurationException; +import org.testng.annotations.Listeners; import org.w3c.dom.CharacterData; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -35,6 +36,7 @@ /* * @summary Test for Comment implementation returned by Document.createComment(String) */ +@Listeners({jaxp.library.FilePolicy.class}) public class CommentTest extends AbstractCharacterDataTest { @Override protected CharacterData createCharacterData(String text) throws IOException, SAXException, ParserConfigurationException { --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java 2016-07-18 00:50:07.362277272 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java 2016-07-18 00:50:07.231342772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -31,9 +31,9 @@ import static org.w3c.dom.ptests.DOMTestUtil.DOMEXCEPTION_EXPECTED; import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS; import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument; -import jaxp.library.JAXPFileBaseTest; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; @@ -44,7 +44,8 @@ /* * @summary Test createAttributeNS, getElementsByTagNameNS and createElementNS method of Document */ -public class DocumentTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class DocumentTest { @DataProvider(name = "invalid-nsuri") public Object[][] getInvalidNamespaceURI() { --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java 2016-07-18 00:50:07.830043271 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java 2016-07-18 00:50:07.704106272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -25,9 +25,9 @@ import static org.testng.Assert.assertEquals; import static org.w3c.dom.ptests.DOMTestUtil.createDOM; -import jaxp.library.JAXPFileBaseTest; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DocumentType; import org.w3c.dom.NamedNodeMap; @@ -35,7 +35,8 @@ /* * @summary Test DocumentType */ -public class DocumentTypeTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class DocumentTypeTest { /* * Test testGetEntities method, and verify the entity items. --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java 2016-07-18 00:50:08.257829272 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java 2016-07-18 00:50:08.139888272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -27,9 +27,8 @@ import javax.xml.parsers.ParserConfigurationException; -import jaxp.library.JAXPBaseTest; - import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; @@ -38,7 +37,8 @@ /* * @summary Test DomImplementation API */ -public class DomImplementationTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class DomImplementationTest { /* * Test createDocument method with a namespace uri, qualified name and null * for the doctype --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java 2016-07-18 00:50:08.851532272 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java 2016-07-18 00:50:08.710602772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -37,9 +37,8 @@ import javax.xml.parsers.DocumentBuilderFactory; -import jaxp.library.JAXPFileBaseTest; - import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; @@ -52,7 +51,8 @@ /* * @summary Test for the methods of Element Interface */ -public class ElementTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class ElementTest { @Test public void testGetAttributeNS() throws Exception { Document document = createDOMWithNS("ElementSample01.xml"); --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java 2016-07-18 00:50:09.338288772 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java 2016-07-18 00:50:09.211352271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -30,8 +30,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import jaxp.library.JAXPFileBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -40,7 +39,8 @@ /* * @summary Test DOM Parser: parsing an xml file that contains external entities. */ -public class EntityChildTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class EntityChildTest { @Test public void test() throws Exception { --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java 2016-07-18 00:50:09.772071771 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java 2016-07-18 00:50:09.650132771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -25,8 +25,8 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS; -import jaxp.library.JAXPFileBaseTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -37,7 +37,8 @@ /* * @summary Test for the methods of NamedNodeMap Interface */ -public class NamedNodeMapTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class NamedNodeMapTest { /* * Test setNamedItemNS method with a node having the same namespaceURI and * qualified name as an existing one, and then test with a non-existing node. --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java 2016-07-18 00:50:10.498708272 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java 2016-07-18 00:50:10.365774772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -24,9 +24,9 @@ import static org.testng.Assert.assertEquals; import static org.w3c.dom.ptests.DOMTestUtil.createDOM; -import jaxp.library.JAXPFileBaseTest; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -37,7 +37,8 @@ * bound, the last element of a NodeList returns null. The bug has been fixed * in jaxp 1.1.1 build. */ -public class NodeListTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class NodeListTest { @DataProvider(name = "xml") public Object[][] getTestData() { --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java 2016-07-18 00:50:10.922496272 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java 2016-07-18 00:50:10.806554272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -41,9 +41,8 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import jaxp.library.JAXPFileBaseTest; - import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMException; import org.w3c.dom.Document; @@ -55,7 +54,8 @@ /* * @summary Test Node interface */ -public class NodeTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class NodeTest { @DataProvider(name = "feature-supported") public Object[][] getFeatureSupportedList() throws Exception { Document document = createDOMWithNS("Node01.xml"); --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java 2016-07-18 00:50:11.370272271 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java 2016-07-18 00:50:11.247333772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -29,8 +29,7 @@ import javax.xml.parsers.ParserConfigurationException; -import jaxp.library.JAXPFileBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; @@ -40,7 +39,8 @@ /* * @summary Test for Notation interface */ -public class NotationTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class NotationTest { /* * Test getSystemId method. */ --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java 2016-07-18 00:50:11.827043772 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java 2016-07-18 00:50:11.707103771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -24,8 +24,8 @@ import static org.testng.Assert.assertEquals; import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS; -import jaxp.library.JAXPFileBaseTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.ProcessingInstruction; @@ -33,7 +33,8 @@ /* * @summary Test for the methods of Processing Instruction */ -public class PITest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class PITest { /* * Test getData, setData and getTarget methods */ --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java 2016-07-18 00:50:12.264824772 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java 2016-07-18 00:50:12.135889272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.parsers.ParserConfigurationException; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.CharacterData; import org.w3c.dom.Document; @@ -41,6 +42,7 @@ /* * @summary Test for Text implementation returned by Document.createTextNode(String) */ +@Listeners({jaxp.library.FilePolicy.class}) public class TextTest extends AbstractCharacterDataTest { /* * Verify splitText method works as the spec. --- old/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java 2016-07-18 00:50:12.697608271 -0700 +++ new/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java 2016-07-18 00:50:12.569672272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, 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 @@ -30,8 +30,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import jaxp.library.JAXPBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -41,7 +40,8 @@ /* * @summary Test getTypeName and getTypeNamespace methods of TypeInfo interface */ -public class TypeInfoTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class TypeInfoTest { /* * Get the TypeInfo of the root element, and verify it. */ --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java 2016-07-18 00:50:13.141386272 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java 2016-07-18 00:50:13.012450772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,16 +22,18 @@ */ package org.xml.sax.ptests; -import jaxp.library.JAXPBaseTest; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.helpers.AttributesImpl; /** * Class containing the test cases for AttributesImpl API. */ -public class AttrImplTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class AttrImplTest { private static final String CAR_URI = "http://www.cars.com/xml"; private static final String CAR_LOCALNAME = "part"; --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java 2016-07-18 00:50:13.600156772 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java 2016-07-18 00:50:13.468222772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,17 +22,20 @@ */ package org.xml.sax.ptests; -import java.io.File; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; import static jaxp.library.JAXPTestUtilities.USER_DIR; import static jaxp.library.JAXPTestUtilities.compareWithGold; import static org.testng.Assert.assertTrue; -import org.testng.annotations.Test; import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; import static org.xml.sax.ptests.SAXTestConst.XML_DIR; +import java.io.File; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; + /** * This tests the Attributes interface. Here the startElement() callback of * ContentHandler has Attributes as one of its arguments. Attributes @@ -40,7 +43,8 @@ * of Attributes interfaces are tested. This program uses Namespace processing * with namespaces in XML file. This program does not use Validation */ -public class AttributesNSTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class AttributesNSTest { /** * Test for Attribute Interface's setter/getter. * --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java 2016-07-18 00:50:14.041935772 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java 2016-07-18 00:50:13.908002772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,17 +22,20 @@ */ package org.xml.sax.ptests; -import java.io.File; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; import static jaxp.library.JAXPTestUtilities.USER_DIR; import static jaxp.library.JAXPTestUtilities.compareWithGold; import static org.testng.Assert.assertTrue; -import org.testng.annotations.Test; import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; import static org.xml.sax.ptests.SAXTestConst.XML_DIR; +import java.io.File; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; + /** * This tests the Attributes interface. Here the startElement() callback of * ContentHandler has Attributes as one of its arguments. Attributes @@ -41,7 +44,8 @@ * This program uses Namespace processing without any namepsaces in xml file. * This program uses Validation */ -public class AttributesTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class AttributesTest { /** * Unit test for Attributes interface. Prints all attributes into output * file. Check it with golden file. --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java 2016-07-18 00:50:14.484714271 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java 2016-07-18 00:50:14.354779272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,15 +22,20 @@ */ package org.xml.sax.ptests; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareWithGold; +import static org.testng.Assert.assertTrue; +import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; +import static org.xml.sax.ptests.SAXTestConst.XML_DIR; + import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; + import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareWithGold; -import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.InputSource; @@ -38,15 +43,14 @@ import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLFilterImpl; -import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; -import static org.xml.sax.ptests.SAXTestConst.XML_DIR; /** * Class registers a content event handler to XMLReader. Content event handler * transverses XML and print all visited node when XMLreader parses XML. Test * verifies output is same as the golden file. */ -public class ContentHandlerTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class ContentHandlerTest { /** * Content event handler visit all nodes to print to output file. * --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java 2016-07-18 00:50:14.934489272 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java 2016-07-18 00:50:14.810551272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,30 +22,34 @@ */ package org.xml.sax.ptests; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareWithGold; +import static org.testng.Assert.assertTrue; +import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; +import static org.xml.sax.ptests.SAXTestConst.XML_DIR; + import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; + import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareWithGold; -import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; -import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; -import static org.xml.sax.ptests.SAXTestConst.XML_DIR; /** * XMLReader parse XML with default handler that transverses XML and * print all visited node. Test verifies output is same as the golden file. */ -public class DefaultHandlerTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class DefaultHandlerTest { /** * Test default handler that transverses XML and print all visited node. * --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java 2016-07-18 00:50:15.378267272 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java 2016-07-18 00:50:15.261325771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,31 +22,35 @@ */ package org.xml.sax.ptests; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareWithGold; +import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; +import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; +import static org.xml.sax.ptests.SAXTestConst.XML_DIR; + import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; + import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareWithGold; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLFilterImpl; -import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; -import static org.xml.sax.ptests.SAXTestConst.XML_DIR; /** * ErrorHandler unit test. Set a ErrorHandle to XMLReader. Capture fatal error * events in ErrorHandler. */ -public class EHFatalTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class EHFatalTest { /** * Error Handler to capture all error events to output file. Verifies the * output file is same as golden file. --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java 2016-07-18 00:50:15.820046271 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java 2016-07-18 00:50:15.701105772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,17 +22,20 @@ */ package org.xml.sax.ptests; -import java.util.Enumeration; -import jaxp.library.JAXPBaseTest; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; + +import java.util.Enumeration; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.helpers.NamespaceSupport; /** * Unit test cases for NamespaceSupport API */ -public class NSSupportTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class NSSupportTest { /** * Empty prefix name. */ --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java 2016-07-18 00:50:16.251830272 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java 2016-07-18 00:50:16.121895271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,11 +22,13 @@ */ package org.xml.sax.ptests; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPBaseTest; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.XMLReader; @@ -34,7 +36,8 @@ * Class containing the test cases for Namespace Table defined at * http://www.megginson.com/SAX/Java/namespaces.html */ -public class NSTableTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class NSTableTest { private static final String NAMESPACES = "http://xml.org/sax/features/namespaces"; private static final String NAMESPACE_PREFIXES = --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java 2016-07-18 00:50:16.686612771 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java 2016-07-18 00:50:16.563674271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,12 +22,16 @@ */ package org.xml.sax.ptests; -import java.io.FileInputStream; -import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileReadOnlyBaseTest; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; +import static org.xml.sax.ptests.SAXTestConst.XML_DIR; + +import java.io.FileInputStream; + +import javax.xml.parsers.SAXParserFactory; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; @@ -37,14 +41,14 @@ import org.xml.sax.helpers.ParserAdapter; import org.xml.sax.helpers.XMLFilterImpl; import org.xml.sax.helpers.XMLReaderAdapter; -import static org.xml.sax.ptests.SAXTestConst.XML_DIR; /** * Unit test cases for ParserAdapter API. By default the only features recognized * are namespaces and namespace-prefixes. */ -public class ParserAdapterTest extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class ParserAdapterTest { /** * namespaces feature name. */ @@ -234,7 +238,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class) + @Test(expectedExceptions = SAXException.class) public void parse02() throws Exception { try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) { InputSource is = new InputSource(fis); @@ -247,7 +251,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void parse03() throws Exception { try(FileInputStream fis = new FileInputStream(XML_DIR + "correct.xml")) { InputSource is = new InputSource(fis); --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java 2016-07-18 00:50:17.130390771 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java 2016-07-18 00:50:17.003454271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,28 +22,32 @@ */ package org.xml.sax.ptests; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareWithGold; +import static org.testng.Assert.assertTrue; +import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; +import static org.xml.sax.ptests.SAXTestConst.XML_DIR; + import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; + import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareWithGold; -import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Listeners; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLFilterImpl; -import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; -import static org.xml.sax.ptests.SAXTestConst.XML_DIR; /** * Entity resolver should be invoked in XML parse. This test verifies parsing * process by checking the output with golden file. */ -public class ResolverTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class ResolverTest { /** * Unit test for entityResolver setter. * --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java 2016-07-18 00:50:17.551180272 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java 2016-07-18 00:50:17.434238772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,21 +22,25 @@ */ package org.xml.sax.ptests; -import java.io.File; -import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; import static jaxp.library.JAXPTestUtilities.USER_DIR; import static jaxp.library.JAXPTestUtilities.compareWithGold; import static org.testng.Assert.assertTrue; -import org.testng.annotations.Test; import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; import static org.xml.sax.ptests.SAXTestConst.XML_DIR; +import java.io.File; + +import javax.xml.parsers.SAXParserFactory; + +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; + /** * This class contains the testcases to test SAXParser with regard to * Namespace Table defined at http://www.megginson.com/SAX/Java/namespaces.html */ -public class SAXParserNSTableTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class SAXParserNSTableTest { /** * namespace processing is enabled. namespace-prefix is also is enabled. * So it is a True-True combination. --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java 2016-07-18 00:50:18.019945772 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java 2016-07-18 00:50:17.899006272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,15 +22,20 @@ */ package org.xml.sax.ptests; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareWithGold; +import static org.testng.Assert.assertTrue; +import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; +import static org.xml.sax.ptests.SAXTestConst.XML_DIR; + import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; + import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareWithGold; -import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Listeners; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.Locator; @@ -38,14 +43,13 @@ import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLFilterImpl; -import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; -import static org.xml.sax.ptests.SAXTestConst.XML_DIR; /** * Set parent of XMLFilter to XMLReader. Parsing on XML file will invoke XMLFilter * to write to output file. Test verifies output is same as the golden file. */ -public class XMLFilterCBTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class XMLFilterCBTest { /** * Test XMLFilter working with XML reader. * --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java 2016-07-18 00:50:18.450730271 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java 2016-07-18 00:50:18.334788272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,23 +22,27 @@ */ package org.xml.sax.ptests; -import java.io.FileInputStream; -import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileReadOnlyBaseTest; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; +import static org.xml.sax.ptests.SAXTestConst.XML_DIR; + +import java.io.FileInputStream; + +import javax.xml.parsers.SAXParserFactory; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLFilterImpl; -import static org.xml.sax.ptests.SAXTestConst.XML_DIR; /** * Unit test for XMLFilter. */ -public class XMLFilterTest extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class XMLFilterTest { /** * name spaces constant. */ @@ -217,7 +221,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void parse02() throws Exception { try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) { new XMLFilterImpl().parse(new InputSource(fis)); @@ -229,7 +233,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void parse03() throws Exception { try(FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) { new XMLFilterImpl().parse(new InputSource(fis)); --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java 2016-07-18 00:50:18.874518272 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java 2016-07-18 00:50:18.756577271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,24 +22,27 @@ */ package org.xml.sax.ptests; -import java.io.FileInputStream; -import java.io.FilePermission; -import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPBaseTest; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; +import static org.xml.sax.ptests.SAXTestConst.XML_DIR; + +import java.io.FileInputStream; + +import javax.xml.parsers.SAXParserFactory; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.HandlerBase; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderAdapter; -import static org.xml.sax.ptests.SAXTestConst.XML_DIR; /** * Class containing the test cases for XMLReaderAdapter API */ -public class XMLReaderAdapterTest extends JAXPBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class XMLReaderAdapterTest { /** * http://xml.org/sax/features/namespace-prefixes property name. */ @@ -92,7 +95,6 @@ */ @Test public void parse01() throws Exception { - setPermissions(new FilePermission(XML_DIR + "/-", "read")); try (FileInputStream fis = new FileInputStream(XML_DIR + "namespace1.xml")) { XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); if (!xmlReader.getFeature(NM_PREFIXES_PROPERTY)) { @@ -102,6 +104,5 @@ xmlRA.setDocumentHandler(new HandlerBase()); xmlRA.parse(new InputSource(fis)); } - setPermissions(); } } --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java 2016-07-18 00:50:19.302304271 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java 2016-07-18 00:50:19.178366272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,8 +22,9 @@ */ package org.xml.sax.ptests; -import jaxp.library.JAXPBaseTest; import static org.testng.Assert.assertNotNull; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; import org.xml.sax.helpers.XMLReaderFactory; @@ -31,7 +32,8 @@ /** * Unit test for XMLReaderFactory.createXMLReader API. */ -public class XMLReaderFactoryTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class XMLReaderFactoryTest { /** * No exception expected when create XMLReader by default. * @throws org.xml.sax.SAXException when xml reader creation failed. @@ -49,7 +51,7 @@ */ @Test public void createReader02() throws SAXException { - setSystemProperty("org.xml.sax.driver", + System.setProperty("org.xml.sax.driver", "com.sun.org.apache.xerces.internal.parsers.SAXParser"); assertNotNull(XMLReaderFactory. createXMLReader("com.sun.org.apache.xerces.internal.parsers.SAXParser")); --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java 2016-07-18 00:50:19.723093771 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java 2016-07-18 00:50:19.606152271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,23 +22,27 @@ */ package org.xml.sax.ptests; -import java.io.FileInputStream; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; import static jaxp.library.JAXPTestUtilities.USER_DIR; import static jaxp.library.JAXPTestUtilities.compareWithGold; import static org.testng.Assert.assertTrue; -import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR; import static org.xml.sax.ptests.SAXTestConst.XML_DIR; +import java.io.FileInputStream; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.testng.annotations.Listeners; +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; + /** This class contains the testcases to test XMLReader with regard to * Namespace Table defined at * http://www.megginson.com/SAX/Java/namespaces.html */ -public class XMLReaderNSTableTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class XMLReaderNSTableTest { /** * XML file that used to be parsed. */ --- old/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java 2016-07-18 00:50:20.152878771 -0700 +++ new/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java 2016-07-18 00:50:20.026941771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,14 +22,18 @@ */ package org.xml.sax.ptests; -import java.io.FileInputStream; -import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileReadOnlyBaseTest; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; +import static org.xml.sax.ptests.SAXTestConst.XML_DIR; + +import java.io.FileInputStream; + +import javax.xml.parsers.SAXParserFactory; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -39,12 +43,12 @@ import org.xml.sax.ext.DeclHandler; import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.XMLFilterImpl; -import static org.xml.sax.ptests.SAXTestConst.XML_DIR; /** * Class containing the test cases for SAXParser API */ -public class XMLReaderTest extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class XMLReaderTest { /** * XML namespaces. @@ -434,7 +438,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class) + @Test(expectedExceptions = SAXException.class) public void parse02() throws Exception { try (FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) { SAXParserFactory spf = SAXParserFactory.newInstance(); @@ -448,7 +452,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void parse03() throws Exception { try (FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) { SAXParserFactory spf = SAXParserFactory.newInstance(); --- old/test/javax/xml/jaxp/functional/test/astro/AstroTest.java 2016-07-18 00:50:20.594657771 -0700 +++ new/test/javax/xml/jaxp/functional/test/astro/AstroTest.java 2016-07-18 00:50:20.468720771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -35,10 +35,9 @@ import javax.xml.transform.sax.TransformerHandler; -import jaxp.library.JAXPFileBaseTest; - import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -66,7 +65,8 @@ * AstroProcessor to test different JAXP classes and features. * */ -public class AstroTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class AstroTest { private FiltersAndGolden[] data; @BeforeClass --- old/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java 2016-07-18 00:50:21.026441772 -0700 +++ new/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java 2016-07-18 00:50:20.899505271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -40,8 +40,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import jaxp.library.JAXPFileBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -54,7 +53,8 @@ /* * @summary org.w3c.dom.ls tests */ -public class DocumentLSTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class DocumentLSTest { /* * Test creating an empty Document */ --- old/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java 2016-07-18 00:50:21.459225272 -0700 +++ new/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java 2016-07-18 00:50:21.340284772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -28,14 +28,14 @@ import javax.xml.namespace.QName; -import jaxp.library.JAXPBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary javax.xml.namespace.QName tests */ -public class NamespaceContextTest extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class NamespaceContextTest { private static final String PREFIX = "astro"; private static final String LOCAL_PART = "stardb"; private static final String NS_URI = "http://www.astro.com"; --- old/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java 2016-07-18 00:50:21.943982772 -0700 +++ new/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java 2016-07-18 00:50:21.814047772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -24,15 +24,15 @@ import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.XMLReader; /* * @summary verify SAX 2.0.1 allows to use null in setters */ -public class SAX201Test extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class SAX201Test { @Test public void test() throws Exception { SAXParserFactory spf = SAXParserFactory.newInstance(); --- old/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java 2016-07-18 00:50:22.467720771 -0700 +++ new/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java 2016-07-18 00:50:22.340784272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -33,8 +33,7 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; @@ -42,7 +41,8 @@ /* * @summary test parser sets schema related properties to do validation */ -public class SchemaValidationTest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class SchemaValidationTest { /* * Only set the schemaLanguage, without setting schemaSource. It should * work. --- old/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java 2016-07-18 00:50:22.890509271 -0700 +++ new/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java 2016-07-18 00:50:22.771568771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 @@ -45,10 +45,9 @@ import javax.xml.xpath.XPathFactory; import javax.xml.xpath.XPathVariableResolver; -import jaxp.library.JAXPFileBaseTest; - import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.NodeList; @@ -58,7 +57,8 @@ * @summary test XPath API */ @Test(singleThreaded = true) -public class XPathAPITest extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class XPathAPITest { private static final String STARDB_STAR_3_CONSTELLATION = "//astro:stardb/astro:star[3]/astro:constellation"; private static final String STARDB_STAR = "//astro:stardb/astro:star"; private Document doc; --- old/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java 2016-07-18 00:50:23.332288272 -0700 +++ new/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java 2016-07-18 00:50:23.204352271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,18 +22,23 @@ */ package test.auctionportal; -import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE; -import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE; +import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; +import static jaxp.library.JAXPTestUtilities.bomStream; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; +import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE; +import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE; +import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS; +import static test.auctionportal.HiBidConstants.XML_DIR; + import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.math.BigInteger; import java.nio.file.Paths; import java.util.GregorianCalendar; -import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; + import javax.xml.datatype.DatatypeConstants; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; @@ -46,8 +51,8 @@ import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; -import jaxp.library.JAXPFileReadOnlyBaseTest; -import static jaxp.library.JAXPTestUtilities.bomStream; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.DOMConfiguration; @@ -58,20 +63,19 @@ import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; -import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS; -import static test.auctionportal.HiBidConstants.XML_DIR; /** * This is the user controller class for the Auction portal HiBid.com. */ -public class AuctionController extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class AuctionController { /** * Check for DOMErrorHandler handling DOMError. Before fix of bug 4890927 * DOMConfiguration.setParameter("well-formed",true) throws an exception. * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCreateNewItem2Sell() throws Exception { String xmlFile = XML_DIR + "novelsInvalid.xml"; @@ -94,7 +98,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCreateNewItem2SellRetry() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; @@ -126,7 +130,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCreateID() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; @@ -147,7 +151,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckingUserData() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; @@ -184,7 +188,7 @@ * @throws Exception If any errors occur. * @see movies.xml */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckingEncoding() throws Exception { // Note since movies.xml is UTF-16 encoding. We're not using stanard XML // file suffix. @@ -206,7 +210,7 @@ * @throws Exception If any errors occur. * @see userDetails.xsd */ - @Test(groups = {"readLocalFiles"}) + @Test public void testGetOwnerInfo() throws Exception { String schemaFile = XML_DIR + "userDetails.xsd"; String xmlFile = XML_DIR + "userDetails.xml"; @@ -241,7 +245,7 @@ * @see coins.xsd * @see coinsImportMe.xsd */ - @Test(groups = {"readLocalFiles"}) + @Test public void testGetOwnerItemList() throws Exception { String xsdFile = XML_DIR + "coins.xsd"; String xmlFile = XML_DIR + "coins.xml"; @@ -277,7 +281,7 @@ * @see coinsImportMe.xsd */ - @Test(groups = {"readLocalFiles"}) + @Test public void testGetOwnerItemList1() throws Exception { String xsdFile = XML_DIR + "coins.xsd"; String xmlFile = XML_DIR + "coins.xml"; @@ -299,7 +303,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testGetItemDuration() throws Exception { String xmlFile = XML_DIR + "itemsDuration.xml"; @@ -332,7 +336,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testGetTypeInfo() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; --- old/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java 2016-07-18 00:50:23.782063272 -0700 +++ new/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java 2016-07-18 00:50:23.653127771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,18 +22,24 @@ */ package test.auctionportal; -import static test.auctionportal.HiBidConstants.SP_ENTITY_EXPANSION_LIMIT; -import static test.auctionportal.HiBidConstants.SP_MAX_OCCUR_LIMIT; +import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING; +import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; +import static test.auctionportal.HiBidConstants.GOLDEN_DIR; import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE; import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE; -import static org.testng.Assert.assertTrue; +import static test.auctionportal.HiBidConstants.SP_ENTITY_EXPANSION_LIMIT; +import static test.auctionportal.HiBidConstants.SP_MAX_OCCUR_LIMIT; +import static test.auctionportal.HiBidConstants.XML_DIR; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.FilePermission; import java.io.InputStream; -import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING; -import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.SAXParser; @@ -41,20 +47,17 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold; -import static org.testng.Assert.assertFalse; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.SAXParseException; -import static test.auctionportal.HiBidConstants.GOLDEN_DIR; -import static test.auctionportal.HiBidConstants.XML_DIR; /** * This is a test class for the Auction portal HiBid.com. */ -public class AuctionItemRepository extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class AuctionItemRepository { /** * XML file for parsing. */ @@ -80,11 +83,10 @@ // implementation limits. factory.setFeature(FEATURE_SECURE_PROCESSING, true); // Set entityExpansionLimit as 2 should expect fatalError - setSystemProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(128000)); + System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(128000)); SAXParser parser = factory.newSAXParser(); MyErrorHandler fatalHandler = new MyErrorHandler(); - setPermissions(new FilePermission(ENTITY_XML, "read")); parser.parse(new File(ENTITY_XML), fatalHandler); assertFalse(fatalHandler.isAnyError()); } @@ -103,11 +105,10 @@ // implementation limits. factory.setFeature(FEATURE_SECURE_PROCESSING, true); // Set entityExpansionLimit as 2 should expect SAXParseException. - setSystemProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(2)); + System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(2)); SAXParser parser = factory.newSAXParser(); MyErrorHandler fatalHandler = new MyErrorHandler(); - setPermissions(new FilePermission(ENTITY_XML, "read")); parser.parse(new File(ENTITY_XML), fatalHandler); } @@ -124,10 +125,9 @@ SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(true); factory.setFeature(FEATURE_SECURE_PROCESSING, true); - setSystemProperty(SP_MAX_OCCUR_LIMIT, String.valueOf(10000)); + System.setProperty(SP_MAX_OCCUR_LIMIT, String.valueOf(10000)); SAXParser parser = factory.newSAXParser(); parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI); - setPermissions(new FilePermission(XML_DIR + "-", "read")); parser.setProperty(JAXP_SCHEMA_SOURCE, new File(schema_file)); try (InputStream is = new FileInputStream(xml_file)) { MyErrorHandler eh = new MyErrorHandler(); @@ -146,17 +146,12 @@ public void testEntityExpansionDOMPos() throws Exception { DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); dfactory.setFeature(FEATURE_SECURE_PROCESSING, true); - setSystemProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(10000)); + System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(10000)); DocumentBuilder dBuilder = dfactory.newDocumentBuilder(); MyErrorHandler eh = new MyErrorHandler(); dBuilder.setErrorHandler(eh); - try { - setPermissions(new FilePermission(ENTITY_XML, "read")); - dBuilder.parse(ENTITY_XML); - assertFalse(eh.isAnyError()); - } finally { - setPermissions(); - } + dBuilder.parse(ENTITY_XML); + assertFalse(eh.isAnyError()); } /** @@ -170,11 +165,10 @@ public void testEntityExpansionDOMNeg() throws Exception { DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); dfactory.setFeature(FEATURE_SECURE_PROCESSING, true); - setSystemProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(2)); + System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(2)); DocumentBuilder dBuilder = dfactory.newDocumentBuilder(); MyErrorHandler eh = new MyErrorHandler(); dBuilder.setErrorHandler(eh); - setPermissions(new FilePermission(ENTITY_XML, "read")); dBuilder.parse(ENTITY_XML); } --- old/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java 2016-07-18 00:50:24.233837271 -0700 +++ new/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java 2016-07-18 00:50:24.107900272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -22,20 +22,26 @@ */ package test.auctionportal; -import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE; +import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; +import static jaxp.library.JAXPTestUtilities.USER_DIR; +import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold; +import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; +import static test.auctionportal.HiBidConstants.GOLDEN_DIR; +import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE; +import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS; +import static test.auctionportal.HiBidConstants.XML_DIR; + import java.io.FileOutputStream; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; -import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import jaxp.library.JAXPFileBaseTest; -import static jaxp.library.JAXPTestUtilities.USER_DIR; -import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -46,14 +52,12 @@ import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSParser; import org.w3c.dom.ls.LSSerializer; -import static test.auctionportal.HiBidConstants.GOLDEN_DIR; -import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS; -import static test.auctionportal.HiBidConstants.XML_DIR; /** * This is the user controller class for the Auction portal HiBid.com. */ -public class UserController extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class UserController { /** * Checking when creating an XML document using DOM Level 2 validating * it without having a schema source or a schema location It must throw a @@ -150,7 +154,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testMoreUserInfo() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); --- old/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java 2016-07-18 00:50:24.673617272 -0700 +++ new/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java 2016-07-18 00:50:24.548679772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -29,16 +29,15 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 4511326 * @summary In forwards-compatible mode the attribute isn't ignored */ - -public class Bug4511326 extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class Bug4511326 { private static final String XSL = "" --- old/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java 2016-07-18 00:50:25.118394772 -0700 +++ new/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java 2016-07-18 00:50:24.991458271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -34,15 +34,15 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 4512806 * @summary test transformer.setOutputProperties(null) */ -public class Bug4512806 extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class Bug4512806 { @Test public void testProperty() throws TransformerConfigurationException { --- old/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java 2016-07-18 00:50:25.561173272 -0700 +++ new/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java 2016-07-18 00:50:25.438234771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -31,16 +31,15 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import jaxp.library.JAXPBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 4515047 * @summary test transform an empty dom source */ - -public class Bug4515047 extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class Bug4515047 { @Test public void testCreateTxDoc() throws TransformerException, ParserConfigurationException { --- old/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java 2016-07-18 00:50:25.984961272 -0700 +++ new/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java 2016-07-18 00:50:25.867020271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -39,10 +39,9 @@ import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.stream.StreamResult; -import jaxp.library.JAXPBaseTest; - import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -53,16 +52,17 @@ * @summary verify property org.xml.sax.driver is used by SAXTransformerFactory */ @Test(singleThreaded = true) -public class Bug4515660 extends JAXPBaseTest { +@Listeners({jaxp.library.BasePolicy.class}) +public class Bug4515660 { @BeforeClass public void setSaxDrier() { - setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName()); + System.setProperty("org.xml.sax.driver", ReaderStub.class.getName()); } @AfterClass public void clearSaxDrier() { - setSystemProperty("org.xml.sax.driver", null); + System.clearProperty("org.xml.sax.driver"); } @Test --- old/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java 2016-07-18 00:50:26.468719271 -0700 +++ new/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java 2016-07-18 00:50:26.341782771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -42,8 +42,7 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -52,7 +51,8 @@ * @summary test transforming to stream with external dtd */ -public class Bug4693341 extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class Bug4693341 { @Test public void test() throws TransformerException, ParserConfigurationException, SAXException, IOException { --- old/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java 2016-07-18 00:50:26.906500271 -0700 +++ new/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java 2016-07-18 00:50:26.785560772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -32,8 +32,7 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import jaxp.library.JAXPFileBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; @@ -45,8 +44,8 @@ * @bug 4848653 * @summary Verify JAXP schemaLanguage property is ignored if setValidating(false) */ - -public class Bug4848653 extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class Bug4848653 { @Test public void test() throws IOException, SAXException, ParserConfigurationException { --- old/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java 2016-07-18 00:50:27.332287271 -0700 +++ new/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java 2016-07-18 00:50:27.216345271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -37,8 +37,7 @@ import javax.xml.transform.dom.DOMResult; import javax.xml.transform.stream.StreamSource; -import jaxp.library.JAXPFileBaseTest; - +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -48,8 +47,8 @@ * @bug 4858685 4894410 * @summary test transforming text node */ - -public class Bug4858685 extends JAXPFileBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class Bug4858685 { @Test public void test() throws TransformerException, IOException { String uri = XML_DIR + "certificate.xml"; --- old/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java 2016-07-18 00:50:27.772067272 -0700 +++ new/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java 2016-07-18 00:50:27.648129271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -22,6 +22,8 @@ */ package jaxp.library; +import static org.testng.Assert.fail; + import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; @@ -34,12 +36,17 @@ import java.nio.charset.UnsupportedCharsetException; import java.nio.file.Files; import java.nio.file.Paths; +import java.security.Permission; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Supplier; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.stream.Stream; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -48,7 +55,7 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import static org.testng.Assert.fail; + import org.w3c.dom.Document; import org.w3c.dom.Node; import org.xml.sax.SAXException; @@ -89,7 +96,7 @@ /** * BOM table for storing BOM header. */ - private final static Map bom = new HashMap<>(); + private final static Map bom = new HashMap(); /** * Initialize all BOM headers. @@ -130,8 +137,15 @@ */ public static boolean compareWithGold(String goldfile, String outputfile, Charset cs) throws IOException { - return Files.readAllLines(Paths.get(goldfile)). + boolean isSame = Files.readAllLines(Paths.get(goldfile)). equals(Files.readAllLines(Paths.get(outputfile), cs)); + if (!isSame) { + System.err.println("Golden file " + goldfile + " :"); + Files.readAllLines(Paths.get(goldfile)).forEach(System.err::println); + System.err.println("Output file " + outputfile + " :"); + Files.readAllLines(Paths.get(outputfile), cs).forEach(System.err::println); + } + return isSame; } /** @@ -308,10 +322,10 @@ int nextNumber = currentFileNumber.contains(clazz) ? currentFileNumber.get(clazz) + 1 : 1; Integer i = currentFileNumber.putIfAbsent(clazz, nextNumber); - if (i != null && i != nextNumber) { + if (i != null) { do { nextNumber = currentFileNumber.get(clazz) + 1; - } while (currentFileNumber.replace(clazz, nextNumber -1, nextNumber)); + } while (!currentFileNumber.replace(clazz, nextNumber - 1, nextNumber)); } return USER_DIR + clazz.getName() + nextNumber + ".out"; } @@ -332,4 +346,94 @@ toAbsolutePath().toString(); return normalizedPath.replace("\\", FILE_SEP) + FILE_SEP; } + + + /** + * Run the RunnableWithException with creating a JAXPPolicyManager and + * assigning temporary permissions. It's not thread-safe to use this + * function. + * + * @param r + * RunnableWithException to execute + * @param ps + * assigning permissions to add. + */ + public static void tryRunWithPolicyManager(RunnableWithException r, Permission... ps) throws Exception { + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); + if (policyManager != null) + Stream.of(ps).forEach(p -> policyManager.addTmpPermission(p)); + try { + r.run(); + } finally { + JAXPPolicyManager.teardownPolicyManager(); + } + } + + /** + * Run the runnable with assigning temporary permissions. This won't impact + * global policy. + * + * @param r + * Runnable to run + * @param ps + * assigning permissions to add. + */ + public static void runWithTmpPermission(Runnable r, Permission... ps) { + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false); + List tmpPermissionIndexes = new ArrayList(); + if (policyManager != null) + Stream.of(ps).forEach(p -> tmpPermissionIndexes.add(policyManager.addTmpPermission(p))); + try { + r.run(); + } finally { + tmpPermissionIndexes.forEach(index -> policyManager.removeTmpPermission(index)); + } + } + + /** + * Run the supplier with assigning temporary permissions. This won't impact + * global policy. + * + * @param s + * Supplier to run + * @param ps + * assigning permissions to add. + */ + public static T runWithTmpPermission(Supplier s, Permission... ps) { + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false); + List tmpPermissionIndexes = new ArrayList(); + if (policyManager != null) + Stream.of(ps).forEach(p -> tmpPermissionIndexes.add(policyManager.addTmpPermission(p))); + try { + return s.get(); + } finally { + tmpPermissionIndexes.forEach(index -> policyManager.removeTmpPermission(index)); + } + } + + /** + * Run the RunnableWithException with assigning temporary permissions. This won't impact + * global policy. + * + * @param r + * RunnableWithException to execute + * @param ps + * assigning permissions to add. + */ + public static void tryRunWithTmpPermission(RunnableWithException r, Permission... ps) throws Exception { + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false); + List tmpPermissionIndexes = new ArrayList(); + if (policyManager != null) + Stream.of(ps).forEach(p -> tmpPermissionIndexes.add(policyManager.addTmpPermission(p))); + try { + r.run(); + } finally { + tmpPermissionIndexes.forEach(index -> policyManager.removeTmpPermission(index)); + } + } + + @FunctionalInterface + public interface RunnableWithException { + void run() throws Exception; + } } --- old/test/javax/xml/jaxp/unittest/TEST.properties 2016-07-18 00:50:28.256824771 -0700 +++ new/test/javax/xml/jaxp/unittest/TEST.properties 2016-07-18 00:50:28.133886272 -0700 @@ -6,4 +6,8 @@ # Declare module dependency modules=java.xml/com.sun.org.apache.xerces.internal.impl \ java.xml/com.sun.org.apache.xerces.internal.jaxp \ - java.xml/com.sun.org.apache.xml.internal.serialize + java.xml/com.sun.org.apache.xml.internal.serialize \ + java.xml/com.sun.org.apache.bcel.internal.classfile \ + java.xml/com.sun.org.apache.bcel.internal.generic \ + java.xml/com.sun.org.apache.xalan.internal.xsltc.trax \ + java.xml/com.sun.org.apache.xml.internal.utils --- old/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java 2016-07-18 00:50:28.692606772 -0700 +++ new/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java 2016-07-18 00:50:28.565670271 -0700 @@ -24,6 +24,7 @@ import java.io.IOException; import java.nio.file.Paths; + import javax.xml.catalog.Catalog; import javax.xml.catalog.CatalogException; import javax.xml.catalog.CatalogFeatures; @@ -35,9 +36,13 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.Source; + +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.ErrorHandler; @@ -50,6 +55,7 @@ * @bug 8081248, 8144966, 8146606, 8146237, 8151154, 8150969, 8151162, 8152527, 8154220 * @summary Tests basic Catalog functions. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CatalogTest { static final String KEY_FILES = "javax.xml.catalog.files"; @@ -521,7 +527,8 @@ /** * SAX handler */ - public class MyHandler extends DefaultHandler2 implements ErrorHandler { + @Listeners({jaxp.library.BasePolicy.class}) +public class MyHandler extends DefaultHandler2 implements ErrorHandler { StringBuilder textContent = new StringBuilder(); SAXParser saxParser; --- old/test/javax/xml/jaxp/unittest/common/Bug6350682.java 2016-07-18 00:50:29.139383272 -0700 +++ new/test/javax/xml/jaxp/unittest/common/Bug6350682.java 2016-07-18 00:50:29.014445772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,12 +28,14 @@ import javax.xml.transform.TransformerFactoryConfigurationError; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6350682 * @summary Test SAXParserFactory and TransformerFactory can newInstance when setContextClassLoader(null). */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6350682 { @Test --- old/test/javax/xml/jaxp/unittest/common/Bug6723276Test.java 2016-07-18 00:50:29.573166271 -0700 +++ new/test/javax/xml/jaxp/unittest/common/Bug6723276Test.java 2016-07-18 00:50:29.450227772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -23,6 +23,7 @@ package common; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.testng.Assert; import java.net.URL; @@ -34,6 +35,7 @@ * @bug 6723276 * @summary Test JAXP class can be loaded by bootstrap classloader. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6723276Test { @Test --- old/test/javax/xml/jaxp/unittest/common/Bug6941169Test.java 2016-07-18 00:50:30.015944772 -0700 +++ new/test/javax/xml/jaxp/unittest/common/Bug6941169Test.java 2016-07-18 00:50:29.891007271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -44,7 +44,10 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathFactory; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -53,6 +56,7 @@ * @bug 6941169 * @summary Test use-service-mechanism feature. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6941169Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/common/Bug7143711Test.java 2016-07-18 00:50:30.457723771 -0700 +++ new/test/javax/xml/jaxp/unittest/common/Bug7143711Test.java 2016-07-18 00:50:30.332786271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,13 +32,17 @@ import javax.xml.validation.SchemaFactory; import javax.xml.xpath.XPathFactory; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 7143711 * @summary Test set use-service-mechanism shall not override what's set by the constructor in secure mode. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug7143711Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/common/Sources.java 2016-07-18 00:50:30.903500772 -0700 +++ new/test/javax/xml/jaxp/unittest/common/Sources.java 2016-07-18 00:50:30.777563772 -0700 @@ -24,9 +24,11 @@ import java.io.ByteArrayInputStream; import java.io.File; +import java.io.FilePermission; import java.io.StringReader; import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; + import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; @@ -39,8 +41,12 @@ import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stax.StAXSource; import javax.xml.transform.stream.StreamSource; + +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -52,6 +58,7 @@ * @summary Tests related to the javax.xml.transform.Source * and org.xml.sax.InputSource */ +@Listeners({jaxp.library.FilePolicy.class}) public class Sources { /** @@ -108,20 +115,22 @@ * DataProvider: sources that are not empty */ @DataProvider(name = "nonEmptySources") - Object[][] getSourcesEx() throws URISyntaxException { + Object[][] getSourcesEx() { StAXSource ss = null; try { ss = new StAXSource(getXMLEventReader()); - } catch (XMLStreamException ex) {} + } catch (XMLStreamException ex) { + } - return new Object[][]{ - //This will set a non-null systemId on the resulting StreamSource - {new StreamSource(new File(""))}, - //Can't tell because XMLStreamReader is a pull parser, cursor advancement - //would have been required in order to examine the reader. - {new StAXSource(getXMLStreamReader())}, - {ss} - }; + return new Object[][] { + // This will set a non-null systemId on the resulting + // StreamSource + { new StreamSource(new File("")) },// )}, + // Can't tell because XMLStreamReader is a pull parser, cursor + // advancement + // would have been required in order to examine the reader. + { new StAXSource(getXMLStreamReader()) }, + { ss } }; } /* --- old/test/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java 2016-07-18 00:50:31.340282272 -0700 +++ new/test/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java 2016-07-18 00:50:31.222341272 -0700 @@ -25,21 +25,24 @@ import java.io.StringReader; import java.io.StringWriter; + import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import org.testng.annotations.Test; + import org.testng.annotations.BeforeClass; +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; /* * @test - * @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp * @bug 8144593 * @summary Check that warnings about unsupported properties from parsers * are suppressed during the transformation process. */ +@Listeners({jaxp.library.BasePolicy.class}) public class TransformationWarningsTest extends WarningsTestBase { @BeforeClass --- old/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java 2016-07-18 00:50:31.789057772 -0700 +++ new/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java 2016-07-18 00:50:31.669117772 -0700 @@ -25,6 +25,7 @@ import java.io.ByteArrayInputStream; import java.io.StringReader; + import javax.xml.XMLConstants; import javax.xml.transform.Source; import javax.xml.transform.sax.SAXSource; @@ -32,17 +33,19 @@ import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; -import org.testng.annotations.Test; + import org.testng.annotations.BeforeClass; +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; import org.xml.sax.InputSource; /* * @test - * @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp * @bug 8144593 * @summary Check that warnings about unsupported properties from SAX * parsers are suppressed during the xml validation process. */ +@Listeners({jaxp.library.InternalAPIPolicy.class}) public class ValidationWarningsTest extends WarningsTestBase { @BeforeClass --- old/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java 2016-07-18 00:50:32.229837271 -0700 +++ new/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java 2016-07-18 00:50:32.111896271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,12 +28,14 @@ import javax.xml.datatype.XMLGregorianCalendar; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6320118 * @summary Test xml datatype XMLGregorianCalendar. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6320118 { DatatypeFactory df; --- old/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java 2016-07-18 00:50:32.668617771 -0700 +++ new/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java 2016-07-18 00:50:32.551676272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,12 +28,14 @@ import javax.xml.datatype.XMLGregorianCalendar; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6937951 * @summary Test midnight is same as the start of the next day in XMLGregorianCalendar. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6937951Test { @Test --- old/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java 2016-07-18 00:50:33.100401771 -0700 +++ new/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java 2016-07-18 00:50:32.974464771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -33,12 +33,14 @@ import javax.xml.namespace.QName; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6937964 * @summary Test Duration is normalized. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6937964Test { /** * Print debugging to System.err. --- old/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java 2016-07-18 00:50:33.538182771 -0700 +++ new/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java 2016-07-18 00:50:33.420241772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,12 +31,14 @@ import javax.xml.datatype.XMLGregorianCalendar; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 7042647 * @summary Test getFirstDayOfWeek is correct after converting XMLGregorianCalendar to a GregorianCalendar. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug7042647Test { @Test --- old/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java 2016-07-18 00:50:33.977962772 -0700 +++ new/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java 2016-07-18 00:50:33.850026772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -34,11 +34,13 @@ import javax.xml.namespace.QName; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test DatatypeFactory. */ +@Listeners({jaxp.library.BasePolicy.class}) public class DatatypeFactoryTest { private static final boolean DEBUG = false; --- old/test/javax/xml/jaxp/unittest/datatype/DurationTest.java 2016-07-18 00:50:34.432735271 -0700 +++ new/test/javax/xml/jaxp/unittest/datatype/DurationTest.java 2016-07-18 00:50:34.307797772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -39,11 +39,13 @@ import org.testng.Assert; import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test Duration. */ +@Listeners({jaxp.library.BasePolicy.class}) public class DurationTest { private final static boolean DEBUG = true; --- old/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java 2016-07-18 00:50:34.870516272 -0700 +++ new/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java 2016-07-18 00:50:34.752575271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,40 +28,43 @@ import javax.xml.datatype.DatatypeFactory; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.annotations.Test; /* * @summary Test Classloader for DatatypeFactory. */ +@Test(singleThreaded = true) public class FactoryFindTest { boolean myClassLoaderUsed = false; - public FactoryFindTest(String name) { + public void runWithSecurityManager() throws Exception { + JAXPTestUtilities.tryRunWithPolicyManager(() -> testFactoryFind()); } - @Test - public void testFactoryFind() { - try { - // System.setProperty("jaxp.debug", "true"); - - DatatypeFactory factory = DatatypeFactory.newInstance(); - Assert.assertTrue(factory.getClass().getClassLoader() == null); - - Thread.currentThread().setContextClassLoader(null); - factory = DatatypeFactory.newInstance(); - Assert.assertTrue(factory.getClass().getClassLoader() == null); - - Thread.currentThread().setContextClassLoader(new MyClassLoader()); - factory = DatatypeFactory.newInstance(); - if (System.getSecurityManager() == null) - Assert.assertTrue(myClassLoaderUsed); - else - Assert.assertFalse(myClassLoaderUsed); - } catch (Exception ex) { - } + public void runWithoutSecurityManager() throws Exception { + testFactoryFind(); + } + + private void testFactoryFind() throws Exception { + // System.setProperty("jaxp.debug", "true"); + + DatatypeFactory factory = DatatypeFactory.newInstance(); + Assert.assertTrue(factory.getClass().getClassLoader() == null); + Thread.currentThread().setContextClassLoader(null); + factory = DatatypeFactory.newInstance(); + Assert.assertTrue(factory.getClass().getClassLoader() == null); + + Thread.currentThread().setContextClassLoader(new MyClassLoader()); + factory = DatatypeFactory.newInstance(); + if (System.getSecurityManager() == null) + Assert.assertTrue(myClassLoaderUsed); + else + Assert.assertFalse(myClassLoaderUsed); } class MyClassLoader extends URLClassLoader { --- old/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java 2016-07-18 00:50:35.307297772 -0700 +++ new/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java 2016-07-18 00:50:35.182360272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -27,12 +27,14 @@ import javax.xml.datatype.Duration; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 8068839 * @summary Verifies that Duration's edge cases */ +@Listeners({jaxp.library.BasePolicy.class}) public class JDK8068839Test { @Test --- old/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java 2016-07-18 00:50:35.755073772 -0700 +++ new/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java 2016-07-18 00:50:35.625138771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,11 +30,13 @@ import org.testng.Assert; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLGregorianCalendar. */ +@Listeners({jaxp.library.BasePolicy.class}) public class XMLGregorianCalendarTest { private static final boolean DEBUG = false; --- old/test/javax/xml/jaxp/unittest/dom/Bug4915524.java 2016-07-18 00:50:36.219841272 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug4915524.java 2016-07-18 00:50:36.082909772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -39,6 +40,7 @@ * @summary Test Document.adoptNode() shall not throw Exception when the source document object is created from different implementation. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug4915524 { String data = "" + "" + "'. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug4915748 { @Test --- old/test/javax/xml/jaxp/unittest/dom/Bug4966082.java 2016-07-18 00:50:37.100400771 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug4966082.java 2016-07-18 00:50:36.980460772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,6 +26,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -33,6 +34,7 @@ * @bug 4966082 * @summary Test Element.getSchemaTypeInfo() returns an instance of TypeInfo instead of null when the document's schema is an XML DTD. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4966082 { @Test --- old/test/javax/xml/jaxp/unittest/dom/Bug4966138.java 2016-07-18 00:50:37.536182772 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug4966138.java 2016-07-18 00:50:37.420240771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.TypeInfo; @@ -35,6 +36,7 @@ * @bug 4966138 * @summary Test Element's TypeInfo.getTypeName() returns a name instead of null in case the element is declared using anonymous simple type. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4966138 { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; --- old/test/javax/xml/jaxp/unittest/dom/Bug4966142.java 2016-07-18 00:50:37.982959272 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug4966142.java 2016-07-18 00:50:37.855023272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.TypeInfo; @@ -35,6 +36,7 @@ * @bug 4966142 * @summary Test TypeInfo.isDerivedFrom(...) works instead of throws UnsupportedOperationException when the TypeInfo instance refers to a simple type. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4966142 { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; --- old/test/javax/xml/jaxp/unittest/dom/Bug4966143.java 2016-07-18 00:50:38.475712772 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug4966143.java 2016-07-18 00:50:38.336782272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.TypeInfo; @@ -36,6 +37,7 @@ * @summary Test isDerivedFrom(...) returns true only if the parameter is DERIVATION_EXTENSION, * in case TypeInfo instance refers to a complex type derived from another complex type by extension. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4966143 { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; --- old/test/javax/xml/jaxp/unittest/dom/Bug6339023.java 2016-07-18 00:50:39.035432772 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug6339023.java 2016-07-18 00:50:38.855522772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMImplementation; @@ -39,6 +40,7 @@ * @bug 6339023 * @summary Test normalize-characters. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6339023 { /* --- old/test/javax/xml/jaxp/unittest/dom/Bug6355326.java 2016-07-18 00:50:39.461219772 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug6355326.java 2016-07-18 00:50:39.341279771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -34,6 +34,7 @@ import org.testng.Assert; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; @@ -46,6 +47,7 @@ * @bug 6355326 * @summary Test DOM implementation encoding. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6355326 { DOMImplementationLS implLS = null; --- old/test/javax/xml/jaxp/unittest/dom/Bug6367542.java 2016-07-18 00:50:39.892004271 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug6367542.java 2016-07-18 00:50:39.771064772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -24,6 +24,7 @@ package dom; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMImplementation; import org.w3c.dom.bootstrap.DOMImplementationRegistry; @@ -32,6 +33,7 @@ * @bug 6367542 * @summary Test DOMImplementationRegistry.getDOMImplementation("XML") returns a DOMImplementation instance. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6367542 { @Test --- old/test/javax/xml/jaxp/unittest/dom/Bug6520131.java 2016-07-18 00:50:40.332783772 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug6520131.java 2016-07-18 00:50:40.216841771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,6 +28,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMError; @@ -40,6 +41,7 @@ * @bug 6520131 * @summary Test DOMErrorHandler reports an error for invalid character. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6520131 { @Test --- old/test/javax/xml/jaxp/unittest/dom/Bug6521260.java 2016-07-18 00:50:40.780559771 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug6521260.java 2016-07-18 00:50:40.655622271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -40,6 +41,7 @@ * @bug 6521260 * @summary Test setAttributeNS doesn't result in an unsorted internal list of attributes. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6521260 { @Test --- old/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java 2016-07-18 00:50:41.223338272 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java 2016-07-18 00:50:41.099400271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,7 +30,10 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; @@ -41,6 +44,7 @@ * @bug 6582545 * @summary Test the value is correct when iterating attributes. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6582545Test { private DocumentBuilder xmlParser = null; private Document document = null; --- old/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java 2016-07-18 00:50:41.676111771 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java 2016-07-18 00:50:41.540179771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -38,6 +39,7 @@ * @bug 6879614 * @summary Test DocumentBuilder can parse the certain xml. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6879614Test { @Test --- old/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java 2016-07-18 00:50:42.096901271 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java 2016-07-18 00:50:41.981958771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.xpath.XPathFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.NodeList; @@ -41,6 +42,7 @@ * @bug 6333993 * @summary Test NodeList.item(valid index) returns value after NodeList.item(NodeList.getLength()). */ +@Listeners({jaxp.library.BasePolicy.class}) public class CR6333993Test { @Test --- old/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java 2016-07-18 00:50:42.520689271 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java 2016-07-18 00:50:42.402748272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMException; import org.w3c.dom.Document; @@ -43,6 +44,7 @@ * @bug 6517707 * @summary Test Node.setNodeValue(value) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only. */ +@Listeners({jaxp.library.BasePolicy.class}) public class CR6517707Test { @Test --- old/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java 2016-07-18 00:50:42.950474271 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java 2016-07-18 00:50:42.831533771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMException; import org.w3c.dom.Document; @@ -42,6 +43,7 @@ * @bug 6517717 * @summary Test Node.setPrefix(prefix) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only. */ +@Listeners({jaxp.library.BasePolicy.class}) public class CR6517717Test { @Test --- old/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java 2016-07-18 00:50:43.400249271 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java 2016-07-18 00:50:43.276311272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.transform.dom.DOMResult; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.bootstrap.DOMImplementationRegistry; @@ -37,6 +38,7 @@ * @bug 6909336 * @summary Test DOM writer can write more that 20 nested elements. */ +@Listeners({jaxp.library.BasePolicy.class}) public class CR6909336Test { @Test --- old/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java 2016-07-18 00:50:43.833032771 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java 2016-07-18 00:50:43.709094771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; @@ -58,6 +59,7 @@ /* * @summary Test DOMConfiguration for supported properties. */ +@Listeners({jaxp.library.FilePolicy.class}) public class DOMConfigurationTest { static class TestHandler implements DOMErrorHandler { --- old/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java 2016-07-18 00:50:44.275811272 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java 2016-07-18 00:50:44.156870771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -26,6 +26,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMImplementation; @@ -33,6 +34,7 @@ * @bug 8042244 * @summary Verifies that the experimental DOM L3 XPath implementation is no longer available. */ +@Listeners({jaxp.library.BasePolicy.class}) public class DOMXPathTest { /* Verifies that DOMImplementation::hasFeature returns false and getFeature --- old/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java 2016-07-18 00:50:44.699599271 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java 2016-07-18 00:50:44.583657272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.DOMImplementation; @@ -40,6 +41,7 @@ * @summary Tests for the Element Traversal interface. */ +@Listeners({jaxp.library.FilePolicy.class}) public class ElementTraversal { /* Verifies that ElementTraversal is supported. --- old/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java 2016-07-18 00:50:45.131383272 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java 2016-07-18 00:50:45.006445772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -23,12 +23,14 @@ package dom; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 8078139 * @summary Verifies that jdk.xml.dom classes are loaded by the ext class loader. */ +@Listeners({jaxp.library.BasePolicy.class}) public class JdkXmlDomTest { @Test public void test() throws ClassNotFoundException { --- old/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java 2016-07-18 00:50:45.591153271 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java 2016-07-18 00:50:45.445226271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -39,6 +40,7 @@ /* * @summary Test Document.getInputEncoding(). */ +@Listeners({jaxp.library.BasePolicy.class}) public class TCKEncodingTest { /** --- old/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java 2016-07-18 00:50:46.026935272 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java 2016-07-18 00:50:45.901997771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -36,6 +36,7 @@ import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMError; import org.w3c.dom.DOMErrorHandler; @@ -52,6 +53,7 @@ * @bug 4973153 * @summary Test LSSerialiser.setEncoding() raises 'unsupported-encoding' error if encoding is invalid. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug4973153 { DOMImplementationLS implLS = null; --- old/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java 2016-07-18 00:50:46.468714272 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java 2016-07-18 00:50:46.346775271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMImplementation; @@ -47,6 +48,7 @@ * @summary Test LSSerializer writes the XML declaration when LSSerializerFilter is set that rejects all nodes and * LSSerializer's configuration set parameter "xml-declaration" to "true". */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6290947 { private static String XML_STRING = "test1"; --- old/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java 2016-07-18 00:50:46.895500772 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java 2016-07-18 00:50:46.778559272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; @@ -43,6 +44,7 @@ * @bug 6354955 * @summary Test LSSerializer can writeToString on DOM Text node with white space. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6354955 { @Test --- old/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java 2016-07-18 00:50:47.320288271 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java 2016-07-18 00:50:47.201347772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMImplementation; @@ -46,6 +47,7 @@ * @bug 6376823 * @summary Test LSSerializer works. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6376823 { private static String XML_STRING = "test1"; --- old/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java 2016-07-18 00:50:47.737079772 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java 2016-07-18 00:50:47.622137272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,6 +27,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -37,6 +38,7 @@ * @bug 6710741 * @summary Test there should be stack trace information if LSSerializer().writeToString reports an exception. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6710741Test { @Test --- old/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java 2016-07-18 00:50:48.171862271 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java 2016-07-18 00:50:48.043926271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.DOMImplementation; @@ -49,6 +50,7 @@ /* * @summary Test Specifications and Descriptions for LSParser. */ +@Listeners({jaxp.library.BasePolicy.class}) public class LSParserTCKTest { DOMImplementationLS implLS = null; --- old/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java 2016-07-18 00:50:48.614640771 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java 2016-07-18 00:50:48.502696772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,6 +27,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMError; @@ -41,6 +42,7 @@ /* * @summary Test LSParser's DOMConfiguration for supported properties. */ +@Listeners({jaxp.library.BasePolicy.class}) public class LSParserTest { @Test --- old/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java 2016-07-18 00:50:49.033431271 -0700 +++ new/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java 2016-07-18 00:50:48.919488272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMError; @@ -51,6 +52,7 @@ * @bug 6439439 8080906 * @summary Test LSSerializer. */ +@Listeners({jaxp.library.BasePolicy.class}) public class LSSerializerTest { private static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print"; --- old/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java 2016-07-18 00:50:49.469213272 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java 2016-07-18 00:50:49.348273772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.helpers.DefaultHandler; @@ -36,6 +37,7 @@ * @bug 4674384 * @summary Test large maxOccurs. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4674384_MAX_OCCURS_Test { @Test --- old/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java 2016-07-18 00:50:49.906994273 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java 2016-07-18 00:50:49.787054271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,6 +27,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -38,6 +39,7 @@ * @bug 4934208 * @summary Test SAXParser can parse keyref constraint with a selector that is a union xpath expression selecting a node and its child. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4934208 { @Test public void test1() throws Exception { --- old/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java 2016-07-18 00:50:50.392751272 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java 2016-07-18 00:50:50.254820271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; @@ -43,6 +44,7 @@ * and/or the "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property * in conjunction with setting a Schema object. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug4967002 { String schemaSource = "\n" + "\n" + " \n" + " \n" + " \n" + " \n" --- old/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java 2016-07-18 00:50:50.824535272 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java 2016-07-18 00:50:50.705594772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,6 +26,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; @@ -34,6 +35,7 @@ * @bug 4985486 * @summary Test SAXParser can parse large characters(more than 10000). */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4985486 { @Test --- old/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java 2016-07-18 00:50:51.259317772 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java 2016-07-18 00:50:51.133380772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,12 +26,14 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 4991020 * @summary Test XPath like "node_name/." can be parsed. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4991020 { protected static SAXParser createParser() throws Exception { --- old/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java 2016-07-18 00:50:51.718088272 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java 2016-07-18 00:50:51.588153271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,12 +26,14 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 4991946 * @summary Can parse the element type is anyType in the schema and is substituted by the simple type via the 'xsi:type' attribute in xml document. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4991946 { protected static SAXParser createParser() throws Exception { --- old/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java 2016-07-18 00:50:52.162865771 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java 2016-07-18 00:50:52.028932772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,6 +26,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; @@ -35,6 +36,7 @@ * @bug 5010072 * @summary Test SchemaFactory throws SAXException if xpath is "@". */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug5010072 { protected static class ErrorHandler extends DefaultHandler { --- old/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java 2016-07-18 00:50:52.604644771 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java 2016-07-18 00:50:52.481706272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -42,6 +43,7 @@ * @summary Test if SAXParserFactory set a Schema object, when SAXParser sets "http://java.sun.com/xml/jaxp/properties/schemaSource" property * and/or "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property, it shall throw SAXException. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug5025825 { String schemaSource = "\n" + "\n" + " \n" --- old/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java 2016-07-18 00:50:53.028432771 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java 2016-07-18 00:50:52.905494272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -24,6 +24,7 @@ package parsers; import java.io.File; +import java.io.FilePermission; import java.io.InputStream; import javax.xml.XMLConstants; @@ -32,6 +33,8 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -41,24 +44,40 @@ * @bug 6309988 * @summary Test elementAttributeLimit, maxOccurLimit, entityExpansionLimit. */ +@Test(singleThreaded = true) public class Bug6309988 { DocumentBuilderFactory dbf = null; - static boolean _isSecureMode = false; - static { - if (System.getSecurityManager() != null) { - _isSecureMode = true; - System.out.println("Security Manager is present"); - } else { - System.out.println("Security Manager is NOT present"); - } + + public void runWithSecurityManager() throws Exception { + JAXPTestUtilities.tryRunWithPolicyManager(() -> test(), + new FilePermission(System.getProperty("test.src") + "/-", "read")); + } + + public void runWithoutSecurityManager() throws Exception { + test(); + } + + private void test() { + testDOMParserElementAttributeLimit(); + testDOMNSParserElementAttributeLimit(); + testDOMNSParserElementAttributeLimitWithoutSecureProcessing(); + testSystemElementAttributeLimitWithoutSecureProcessing(); + testSystemElementAttributeLimitWithSecureProcessing(); + testDOMSecureProcessingDefaultValue(); + testSAXSecureProcessingDefaultValue(); + testSystemMaxOccurLimitWithoutSecureProcessing(); + testValidMaxOccurLimitWithOutSecureProcessing(); + testSystemEntityExpansionLimitWithOutSecureProcessing(); + testSystemEntityExpansionLimitWithSecureProcessing(); + testEntityExpansionLimitWithSecureProcessing(); + testEntityExpansionLimitWithOutSecureProcessing(); } /* * Given XML document has more than 10000 attributes. Exception is expected */ - @Test - public void testDOMParserElementAttributeLimit() { + private void testDOMParserElementAttributeLimit() { try { dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder parser = dbf.newDocumentBuilder(); @@ -75,8 +94,7 @@ * Given XML document has more than 10000 attributes. It should report an * error. */ - @Test - public void testDOMNSParserElementAttributeLimit() { + private void testDOMNSParserElementAttributeLimit() { try { dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); @@ -94,9 +112,8 @@ * Given XML document has more than 10000 attributes. Parsing this XML * document in non-secure mode, should not report any error. */ - @Test - public void testDOMNSParserElementAttributeLimitWithoutSecureProcessing() { - if (_isSecureMode) + private void testDOMNSParserElementAttributeLimitWithoutSecureProcessing() { + if (isSecureMode()) return; // jaxp secure feature can not be turned off when security // manager is present try { @@ -121,9 +138,8 @@ * test should be the same as * testSystemElementAttributeLimitWithSecureProcessing */ - @Test - public void testSystemElementAttributeLimitWithoutSecureProcessing() { - if (_isSecureMode) + private void testSystemElementAttributeLimitWithoutSecureProcessing() { + if (isSecureMode()) return; // jaxp secure feature can not be turned off when security // manager is present try { @@ -155,8 +171,7 @@ * Given XML document has 3 attributes and System property is set to 2. * Parsing this XML document in secure mode, should report an error. */ - @Test - public void testSystemElementAttributeLimitWithSecureProcessing() { + private void testSystemElementAttributeLimitWithSecureProcessing() { try { dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); @@ -176,8 +191,7 @@ /* * Default value for secure processing feature should be true. */ - @Test - public void testDOMSecureProcessingDefaultValue() { + private void testDOMSecureProcessingDefaultValue() { try { dbf = DocumentBuilderFactory.newInstance(); Assert.assertTrue(dbf.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING), "Default value for secureProcessing feature should be true"); @@ -190,8 +204,7 @@ /* * Default value for secure processing feature should be true. */ - @Test - public void testSAXSecureProcessingDefaultValue() { + private void testSAXSecureProcessingDefaultValue() { try { SAXParserFactory spf = SAXParserFactory.newInstance(); Assert.assertTrue(spf.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING), "Default value for secureProcessing feature should be true"); @@ -206,9 +219,8 @@ * feature is off. Given doument contains more than 2 elements and hence an * error should be reported. */ - @Test - public void testSystemMaxOccurLimitWithoutSecureProcessing() { - if (_isSecureMode) + private void testSystemMaxOccurLimitWithoutSecureProcessing() { + if (isSecureMode()) return; // jaxp secure feature can not be turned off when security // manager is present try { @@ -242,9 +254,8 @@ * maxOccur is '3002'. Since secure processing feature is off, document * should be parsed without any errors. */ - @Test - public void testValidMaxOccurLimitWithOutSecureProcessing() { - if (_isSecureMode) + private void testValidMaxOccurLimitWithOutSecureProcessing() { + if (isSecureMode()) return; // jaxp secure feature can not be turned off when security // manager is present try { @@ -279,9 +290,8 @@ * test should be the same as * testSystemElementAttributeLimitWithSecureProcessing */ - @Test - public void testSystemEntityExpansionLimitWithOutSecureProcessing() { - if (_isSecureMode) + private void testSystemEntityExpansionLimitWithOutSecureProcessing() { + if (isSecureMode()) return; // jaxp secure feature can not be turned off when security // manager is present try { @@ -312,8 +322,7 @@ * System property is set to 2. Given XML document has more than 2 entity * references. Parsing this document in secure mode, should report an error. */ - @Test - public void testSystemEntityExpansionLimitWithSecureProcessing() { + private void testSystemEntityExpansionLimitWithSecureProcessing() { try { dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(true); @@ -335,8 +344,7 @@ * Given XML document has more than 64000 entity references. Parsing this * document in secure mode, should report an error. */ - @Test - public void testEntityExpansionLimitWithSecureProcessing() { + private void testEntityExpansionLimitWithSecureProcessing() { try { dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(true); @@ -357,9 +365,8 @@ * Given XML document has more than 64000 entity references. Parsing this * document in non-secure mode, should not report any error. */ - @Test - public void testEntityExpansionLimitWithOutSecureProcessing() { - if (_isSecureMode) + private void testEntityExpansionLimitWithOutSecureProcessing() { + if (isSecureMode()) return; // jaxp secure feature can not be turned off when security // manager is present try { @@ -377,4 +384,8 @@ System.setProperty("entityExpansionLimit", ""); } } + + private boolean isSecureMode() { + return System.getSecurityManager() != null; + } } --- old/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java 2016-07-18 00:50:53.653120271 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java 2016-07-18 00:50:53.518187771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -39,13 +40,14 @@ * @bug 6341770 * @summary Test external entity linked to non-ASCII base URL. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6341770 { // naming a file "aux" would fail on windows. @Test public void testNonAsciiURI() { try { - File dir = File.createTempFile("sko\u0159ice", null); + File dir = new File("sko\u0159ice"); dir.delete(); dir.mkdir(); File main = new File(dir, "main.xml"); --- old/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java 2016-07-18 00:50:54.088902271 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java 2016-07-18 00:50:53.967962772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,12 +27,14 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6361283 * @summary Test SAXParser returns version as 1.1 for XML 1.1 document. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6361283 { @Test --- old/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java 2016-07-18 00:50:54.533679771 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java 2016-07-18 00:50:54.404744272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,7 +26,10 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.XMLReader; @@ -34,6 +37,7 @@ * @bug 6506304 * @summary Test MalformedURLException: unknown protocol won't be thrown when there is a space within the full path file name. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6506304Test { public static boolean isWindows = false; static { --- old/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java 2016-07-18 00:50:55.018437271 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java 2016-07-18 00:50:54.895498772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.InputSource; @@ -38,6 +39,7 @@ * @bug 6518733 * @summary Test SAX parser handles several attributes that each contain a newline within the attribute value. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6518733 { @Test --- old/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java 2016-07-18 00:50:55.464214272 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java 2016-07-18 00:50:55.346273272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -38,6 +38,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -49,6 +50,7 @@ * @bug 6564400 * @summary Test ignorable whitespace handling with schema validation. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6564400 { private boolean sawIgnorable = false; Schema schema = null; @@ -168,7 +170,8 @@ return ok; } - public class MyHandler extends DefaultHandler { + @Listeners({jaxp.library.BasePolicy.class}) +public class MyHandler extends DefaultHandler { public void ignorableWhitespace(char[] ch, int start, int length) { sawIgnorable = true; } --- old/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java 2016-07-18 00:50:55.892999771 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java 2016-07-18 00:50:55.771060772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,12 +29,14 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6573786 * @summary Test parser error messages are formatted. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6573786 { String _cache = ""; --- old/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java 2016-07-18 00:50:56.344773771 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java 2016-07-18 00:50:56.224833772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java 2016-07-18 00:50:56.800545771 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java 2016-07-18 00:50:56.676607771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -34,6 +34,7 @@ import javax.xml.transform.stream.StreamResult; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.helpers.DefaultHandler; @@ -42,6 +43,7 @@ * @bug 6594813 * @summary Test SAXParser output is wellformed with name space. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6594813 { public Bug6594813(String name) { --- old/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java 2016-07-18 00:50:57.227332271 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java 2016-07-18 00:50:57.110390771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; @@ -38,6 +39,7 @@ * @bug 6608841 * @summary Test SAX parses external parameter entity. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6608841 { public Bug6608841(String name) { } @@ -50,6 +52,7 @@ parser.parse(new File(file), new MyHandler()); } - public class MyHandler extends DefaultHandler { + @Listeners({jaxp.library.BasePolicy.class}) +public class MyHandler extends DefaultHandler { } } --- old/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java 2016-07-18 00:50:57.663114272 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java 2016-07-18 00:50:57.539176271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,6 +28,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -40,6 +41,7 @@ * @bug 6518733 * @summary Test SAX parser handles several attributes with newlines. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6690015 { public Bug6690015() { --- old/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java 2016-07-18 00:50:58.088901272 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java 2016-07-18 00:50:57.967961772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; @@ -42,6 +43,7 @@ * @bug 6518733 * @summary Test SAX parser handles several attributes with containing ">". */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6760982 { @Test --- old/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java 2016-07-18 00:50:58.554668272 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java 2016-07-18 00:50:58.436727271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.ProcessingInstruction; @@ -38,6 +39,7 @@ * @bug 6849942 * @summary Test parsing an XML that starts with a processing instruction and no prolog. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6849942Test { @Test --- old/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java 2016-07-18 00:50:59.005442772 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java 2016-07-18 00:50:58.870510271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,8 +29,11 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -42,6 +45,7 @@ * @bug 7157608 * @summary Test feature standard-uri-conformant works. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug7157608Test { public static boolean isWindows = false; static { --- old/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java 2016-07-18 00:50:59.450220271 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java 2016-07-18 00:50:59.325282772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -38,6 +39,7 @@ * @bug 7166896 * @summary Test DocumentBuilder.parse(String uri) supports IPv6 format. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug7166896Test { @Test --- old/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java 2016-07-18 00:50:59.887001772 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java 2016-07-18 00:50:59.762064271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -23,24 +23,28 @@ package parsers; +import static org.testng.Assert.assertTrue; + import java.io.StringReader; import java.util.Locale; -import javax.xml.parsers.DocumentBuilderFactory; + import javax.xml.parsers.DocumentBuilder; -import org.xml.sax.SAXException; -import org.xml.sax.InputSource; +import javax.xml.parsers.DocumentBuilderFactory; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; -import static org.testng.Assert.assertTrue; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; /** * @bug 8073385 * @summary test that invalid XML character exception string contains * information about character value, element and attribute names */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug8073385 { private Locale defLoc; --- old/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java 2016-07-18 00:51:00.322783771 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java 2016-07-18 00:51:00.198845771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,37 +28,43 @@ import javax.xml.parsers.SAXParserFactory; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.annotations.Test; /* * @summary Test Classloader for SAXParserFactory. */ +@Test(singleThreaded = true) public class FactoryFindTest { boolean myClassLoaderUsed = false; - @Test - public void testFactoryFind() { - try { - // System.setProperty("jaxp.debug", "true"); - - SAXParserFactory factory = SAXParserFactory.newInstance(); - Assert.assertTrue(factory.getClass().getClassLoader() == null); - - Thread.currentThread().setContextClassLoader(null); - factory = SAXParserFactory.newInstance(); - Assert.assertTrue(factory.getClass().getClassLoader() == null); - - Thread.currentThread().setContextClassLoader(new MyClassLoader()); - factory = SAXParserFactory.newInstance(); - if (System.getSecurityManager() == null) - Assert.assertTrue(myClassLoaderUsed); - else - Assert.assertFalse(myClassLoaderUsed); - } catch (Exception ex) { - } + public void runWithSecurityManager() throws Exception { + JAXPTestUtilities.tryRunWithPolicyManager(() -> testFactoryFind()); + } + + public void runWithoutSecurityManager() throws Exception { + testFactoryFind(); + } + + private void testFactoryFind() { + // System.setProperty("jaxp.debug", "true"); + + SAXParserFactory factory = SAXParserFactory.newInstance(); + Assert.assertTrue(factory.getClass().getClassLoader() == null); + Thread.currentThread().setContextClassLoader(null); + factory = SAXParserFactory.newInstance(); + Assert.assertTrue(factory.getClass().getClassLoader() == null); + + Thread.currentThread().setContextClassLoader(new MyClassLoader()); + factory = SAXParserFactory.newInstance(); + if (System.getSecurityManager() == null) + Assert.assertTrue(myClassLoaderUsed); + else + Assert.assertFalse(myClassLoaderUsed); } class MyClassLoader extends URLClassLoader { --- old/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java 2016-07-18 00:51:00.829530271 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java 2016-07-18 00:51:00.661614271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java 2016-07-18 00:51:01.489200272 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java 2016-07-18 00:51:01.286301771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java 2016-07-18 00:51:01.971958771 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java 2016-07-18 00:51:01.855017272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.helpers.DefaultHandler; @@ -36,6 +37,7 @@ /* * @summary Test SAXParser doesn't accept empty stream. */ +@Listeners({jaxp.library.BasePolicy.class}) public class ParseEmptyStream { SAXParserFactory factory = null; --- old/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java 2016-07-18 00:51:02.409739771 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java 2016-07-18 00:51:02.283802771 -0700 @@ -5,6 +5,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; @@ -17,6 +18,7 @@ * Joe Wang (huizhe.wang@oracle.com) */ +@Listeners({jaxp.library.BasePolicy.class}) public class SupplementaryChars { @Test(dataProvider = "supported") --- old/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java 2016-07-18 00:51:02.844522271 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java 2016-07-18 00:51:02.724582271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -37,6 +37,7 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.NodeList; @@ -46,6 +47,7 @@ * @summary Test JAXP parser can resolve the included content properly if the * included xml contains an empty tag that ends with "/>", refer to XERCESJ-1134. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6794483Test { @Test --- old/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java 2016-07-18 00:51:03.299294772 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java 2016-07-18 00:51:03.160364272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -24,12 +24,14 @@ package sax; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ext.Attributes2Impl; /* * @summary Test Attributes2Impl. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Attributes2ImplTest { @Test --- old/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java 2016-07-18 00:51:03.739074771 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java 2016-07-18 00:51:03.618135272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -39,6 +40,7 @@ * @bug 6889654 * @summary Test SAXException includes whole information. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6889654Test { final String MSG = "Failed to parse XML"; --- old/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java 2016-07-18 00:51:04.187850272 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java 2016-07-18 00:51:04.058914771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -25,6 +25,7 @@ import javax.xml.datatype.DatatypeConfigurationException; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.testng.Assert; import org.xml.sax.helpers.XMLReaderFactory; @@ -33,6 +34,7 @@ * @bug 6925410 * @summary Test XMLReaderFactory can createXMLReader repeatedly. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6925410Test { @Test --- old/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java 2016-07-18 00:51:04.618634771 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java 2016-07-18 00:51:04.501693271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -38,6 +39,7 @@ * @bug 6949607 * @summary Test Attributes.getValue returns null when parameter uri is empty. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6949607Test { final String MSG = "Failed to parse XML"; --- old/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java 2016-07-18 00:51:05.059414271 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java 2016-07-18 00:51:04.931478272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; @@ -43,6 +44,7 @@ * @bug 6992561 * @summary Test encoding of SystemId in Locator. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6992561Test { @Test --- old/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java 2016-07-18 00:51:05.512187772 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java 2016-07-18 00:51:05.388249772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -38,8 +38,11 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import org.testng.annotations.Test; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -51,6 +54,7 @@ * @bug 7057778 * @summary Test the file can be deleted after SAXParser.parse(File, DefaultHandler). */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug7057778Test { static final String xml = "Bug7057778.xml"; @@ -59,7 +63,7 @@ @Test public void testParse() { File src = new File(getClass().getResource(xml).getFile()); - File dst = new File(src.getParent() + File.separator + xml1); + File dst = new File(xml1); try { copyFile(src, dst); SAXParserFactory spf = SAXParserFactory.newInstance(); @@ -98,7 +102,8 @@ out.close(); } - public class MyHandler1 extends DefaultHandler2 implements ErrorHandler { + @Listeners({jaxp.library.BasePolicy.class}) +public class MyHandler1 extends DefaultHandler2 implements ErrorHandler { private Writer out; StringBuffer textBuffer; --- old/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java 2016-07-18 00:51:05.942972272 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java 2016-07-18 00:51:05.819034272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import org.testng.Assert; import org.testng.AssertJUnit; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; @@ -44,6 +45,7 @@ /* * @summary Test DefaultHandler2. */ +@Listeners({jaxp.library.FilePolicy.class}) public class DefaultHandler2Test { @Test --- old/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java 2016-07-18 00:51:06.386750271 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java 2016-07-18 00:51:06.266810272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.ErrorHandler; @@ -42,6 +43,7 @@ * @bug 6809409 * @summary Test SAXException has Cause. */ +@Listeners({jaxp.library.BasePolicy.class}) public class IssueTracker56Test { @Test @@ -84,7 +86,8 @@ } - public class MyHandler extends DefaultHandler implements ErrorHandler { + @Listeners({jaxp.library.BasePolicy.class}) +public class MyHandler extends DefaultHandler implements ErrorHandler { public void startDocument() throws SAXException { } @@ -110,7 +113,8 @@ } - public class MyHandler1 extends DefaultHandler implements ErrorHandler { + @Listeners({jaxp.library.BasePolicy.class}) +public class MyHandler1 extends DefaultHandler implements ErrorHandler { public void startDocument() throws SAXException { } --- old/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java 2016-07-18 00:51:06.824531272 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java 2016-07-18 00:51:06.709588772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java 2016-07-18 00:51:07.274306272 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java 2016-07-18 00:51:07.156365271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,12 +27,14 @@ import org.testng.Assert; import org.testng.AssertJUnit; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.helpers.NamespaceSupport; /* * @summary Test NamespaceSupport. */ +@Listeners({jaxp.library.BasePolicy.class}) public class NSSupportTest { @Test --- old/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java 2016-07-18 00:51:07.717084772 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java 2016-07-18 00:51:07.599143771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java 2016-07-18 00:51:08.172856771 -0700 +++ new/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java 2016-07-18 00:51:08.046919772 -0700 @@ -26,7 +26,11 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; + +import jaxp.library.JAXPTestUtilities; + import org.testng.annotations.AfterClass; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; import org.xml.sax.helpers.XMLReaderAdapter; @@ -35,6 +39,7 @@ * @bug 8158246 * @summary This class contains tests that cover the creation of XMLReader. */ +@Listeners({jaxp.library.BasePolicy.class}) public class XMLReaderTest { private final String SAX_PROPNAME = "org.xml.sax.driver"; --- old/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java 2016-07-18 00:51:08.636624772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java 2016-07-18 00:51:08.513686272 -0700 @@ -30,11 +30,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLStreamReader.getAttributeLocalName(). */ +@Listeners({jaxp.library.BasePolicy.class}) public class AttributeLocalNameTest { static final String XML = "" + ""; --- old/test/javax/xml/jaxp/unittest/stream/Bug6370703.java 2016-07-18 00:51:09.060412772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/Bug6370703.java 2016-07-18 00:51:08.939473271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,12 +27,14 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6370703 * @summary Test StAX parser can parse attribute default value when START_ELEMENT. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6370703 { private static String INPUT_FILE = "sgml.xml"; --- old/test/javax/xml/jaxp/unittest/stream/Bug6378422.java 2016-07-18 00:51:09.567159271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/Bug6378422.java 2016-07-18 00:51:09.438223771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,12 +26,14 @@ import javax.xml.stream.XMLInputFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6378422 * @summary Test setting reuse-instance property on StAX factory. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6378422 { @Test --- old/test/javax/xml/jaxp/unittest/stream/Bug6380870.java 2016-07-18 00:51:10.010937272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/Bug6380870.java 2016-07-18 00:51:09.889997772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,12 +27,14 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6380870 * @summary Test StAX parser can parse VoiceXML DTD. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6380870 { private static String INPUT_FILE = "basic-form.vxml"; --- old/test/javax/xml/jaxp/unittest/stream/Bug6489502.java 2016-07-18 00:51:10.448718272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/Bug6489502.java 2016-07-18 00:51:10.316784272 -0700 @@ -30,12 +30,14 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6489502 * @summary Test XMLInputFactory works correctly in case it repeats to create reader. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6489502 { public java.io.File input; --- old/test/javax/xml/jaxp/unittest/stream/Bug6509774.java 2016-07-18 00:51:10.874505271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/Bug6509774.java 2016-07-18 00:51:10.750567271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,12 +28,14 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6509774 * @summary Test Property javax.xml.stream.supportDTD, DTD events are now returned even if supportDTD=false. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6509774 { @Test --- old/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java 2016-07-18 00:51:11.340272272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java 2016-07-18 00:51:11.199342772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -34,12 +34,14 @@ import javax.xml.stream.XMLStreamWriter; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6688002 * @summary Test single instance of XMLOutputFactory/XMLInputFactory create multiple Writer/Readers in parallel. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6688002Test { private static final XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); @@ -60,7 +62,8 @@ } } - public class MyRunnable implements Runnable { + @Listeners({jaxp.library.BasePolicy.class}) +public class MyRunnable implements Runnable { final int no; MyRunnable(int no) { --- old/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java 2016-07-18 00:51:11.818033271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java 2016-07-18 00:51:11.689097771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,12 +31,14 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6976938 * @summary Test StAX parser won't throw StackOverflowError while reading valid XML file, in case the text content of an XML element contains many lines like "< ... >". */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6976938Test { private static final String INPUT_FILE = "Bug6976938.xml"; --- old/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java 2016-07-18 00:51:12.364759772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java 2016-07-18 00:51:12.148867771 -0700 @@ -32,11 +32,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test Coalesce property works. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CoalesceTest { String countryElementContent = "START India CS}}}}}} India END"; --- old/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java 2016-07-18 00:51:12.847518271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java 2016-07-18 00:51:12.718582771 -0700 @@ -37,11 +37,13 @@ import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test StAX parses entity. */ +@Listeners({jaxp.library.FilePolicy.class}) public class EntityTest { XMLInputFactory factory = null; --- old/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java 2016-07-18 00:51:13.305289271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java 2016-07-18 00:51:13.174354772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -23,6 +23,7 @@ package stream; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.testng.Assert; @@ -41,6 +42,7 @@ /* * @summary Test EventReaderDelegate. */ +@Listeners({jaxp.library.FilePolicy.class}) public class EventReaderDelegateTest { public EventReaderDelegateTest(String name) { --- old/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java 2016-07-18 00:51:13.746068771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java 2016-07-18 00:51:13.623130272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -48,12 +48,14 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6631268 * @summary Test XMLEvent.writeAsEncodedUnicode can output the event content. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Issue41Test { public java.io.File input; --- old/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java 2016-07-18 00:51:14.413734771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java 2016-07-18 00:51:14.056913271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -37,12 +37,14 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6620632 * @summary Test XMLEventReader can parse notation and entity information from DTD Event. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Issue48Test { public java.io.File input; --- old/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java 2016-07-18 00:51:14.841520771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java 2016-07-18 00:51:14.724579271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,11 +27,13 @@ import javax.xml.stream.events.StartDocument; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test encodingSet/standaloneSet returns correct result in case encoding/standalone is set when constructing StartDocument. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Issue53Test { @Test --- old/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java 2016-07-18 00:51:15.297292771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java 2016-07-18 00:51:15.164359271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,11 +32,13 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLEvent.getLocation() returns a non-volatile Location. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Issue58Test { public java.io.File input; --- old/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java 2016-07-18 00:51:15.730076271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java 2016-07-18 00:51:15.612135271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -36,24 +36,25 @@ import javax.xml.stream.XMLOutputFactory; import org.testng.Assert; -import org.testng.annotations.BeforeClass; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test SaTX factory using factory property and using ContextClassLoader. */ +@Listeners({jaxp.library.FilePolicy.class}) public class FactoryFindTest { boolean myClassLoaderUsed = false; final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory"; - @BeforeClass - public void setup(){ - policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile()); - } +// @BeforeClass +// public void setup(){ +// policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile()); +// } - @Test + @Test(enabled=false) public void testFactoryFindUsingStaxProperties() { // If property is defined, will take precendence so this test // is ignored :( @@ -107,6 +108,7 @@ Thread.currentThread().setContextClassLoader(new MyClassLoader()); factory = XMLInputFactory.newInstance(); + // because it's decided by having sm or not in FactoryFind code if (System.getSecurityManager() == null) Assert.assertTrue(myClassLoaderUsed); else --- old/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java 2016-07-18 00:51:16.163859271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java 2016-07-18 00:51:16.047917271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,11 +30,13 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test feature ignore-external-dtd. */ +@Listeners({jaxp.library.FilePolicy.class}) public class IgnoreExternalDTDTest { final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory"; --- old/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java 2016-07-18 00:51:16.613634272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java 2016-07-18 00:51:16.490695772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,11 +30,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLStreamReader parses Processing Instruction. */ +@Listeners({jaxp.library.BasePolicy.class}) public class ProcessingInstructionTest { @Test --- old/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java 2016-07-18 00:51:17.043419271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java 2016-07-18 00:51:16.925478271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -38,11 +38,13 @@ import javax.xml.stream.util.StreamReaderDelegate; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test StreamReaderDelegate. */ +@Listeners({jaxp.library.FilePolicy.class}) public class StreamReaderDelegateTest { /** --- old/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java 2016-07-18 00:51:17.476202772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java 2016-07-18 00:51:17.355263272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,11 +28,13 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLEvent Location. */ +@Listeners({jaxp.library.BasePolicy.class}) public class XMLEventLocationTest { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java 2016-07-18 00:51:17.907986771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java 2016-07-18 00:51:17.782049771 -0700 @@ -29,12 +29,14 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6489890 * @summary Test XMLEventReader's initial state is an undefined state, and nextEvent() is START_DOCUMENT. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6489890 { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java 2016-07-18 00:51:18.349765772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java 2016-07-18 00:51:18.220830271 -0700 @@ -22,6 +22,7 @@ */ package stream.XMLEventReaderTest; +import java.io.FilePermission; import java.io.StringReader; import javax.xml.stream.XMLEventReader; @@ -29,76 +30,85 @@ import javax.xml.stream.events.EntityReference; import javax.xml.stream.events.XMLEvent; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6555001 * @summary Test StAX parser replaces the entity reference as setting. */ +@Listeners({ jaxp.library.BasePolicy.class }) public class Bug6555001 { - private static final String XML = "" + "'>" + "]>" - + "&def;&undef;"; + private static final String XML = "" + + "'>" + "]>" + "&def;&undef;"; @Test public void testReplacing() throws Exception { - XMLInputFactory factory = XMLInputFactory.newInstance(); - factory.setProperty("javax.xml.stream.isReplacingEntityReferences", true); - - StringReader sr = new StringReader(XML); - XMLEventReader reader = factory.createXMLEventReader(sr); - - boolean sawUndef = false; - boolean sawDef = false; - - while (reader.hasNext()) { - XMLEvent event = reader.nextEvent(); - // System.out.println("Event: " + event); - if (event.isEntityReference()) { - EntityReference ref = (EntityReference) event; - if ("def".equals(ref.getName())) { - sawDef = true; - } else if ("undef".equals(ref.getName())) { - sawUndef = true; - } else { - throw new IllegalArgumentException("Unexpected entity name"); + JAXPTestUtilities.tryRunWithTmpPermission(() -> { + XMLInputFactory factory = XMLInputFactory.newInstance(); + factory.setProperty("javax.xml.stream.isReplacingEntityReferences", true); + + StringReader sr = new StringReader(XML); + XMLEventReader reader = factory.createXMLEventReader(sr); + + boolean sawUndef = false; + boolean sawDef = false; + + while (reader.hasNext()) { + XMLEvent event = reader.nextEvent(); + // System.out.println("Event: " + event); + if (event.isEntityReference()) { + EntityReference ref = (EntityReference) event; + if ("def".equals(ref.getName())) { + sawDef = true; + } else if ("undef".equals(ref.getName())) { + sawUndef = true; + } else { + throw new IllegalArgumentException("Unexpected entity name"); + } } } - } - Assert.assertEquals(false, sawDef); - Assert.assertEquals(true, sawUndef); - reader.close(); + Assert.assertEquals(false, sawDef); + Assert.assertEquals(true, sawUndef); + reader.close(); + }, new FilePermission("/tmp/this/does/not/exist/but/that/is/ok", "read")); } @Test public void testNotReplacing() throws Exception { - XMLInputFactory factory = XMLInputFactory.newInstance(); - factory.setProperty("javax.xml.stream.isReplacingEntityReferences", false); - - StringReader sr = new StringReader(XML); - XMLEventReader reader = factory.createXMLEventReader(sr); - - boolean sawUndef = false; - boolean sawDef = false; - - while (reader.hasNext()) { - XMLEvent event = reader.nextEvent(); - // System.out.println("Event: " + event); - if (event.isEntityReference()) { - EntityReference ref = (EntityReference) event; - if ("def".equals(ref.getName())) { - sawDef = true; - } else if ("undef".equals(ref.getName())) { - sawUndef = true; - } else { - throw new IllegalArgumentException("Unexpected entity name"); + JAXPTestUtilities.tryRunWithTmpPermission(() -> { + XMLInputFactory factory = XMLInputFactory.newInstance(); + factory.setProperty("javax.xml.stream.isReplacingEntityReferences", false); + + StringReader sr = new StringReader(XML); + XMLEventReader reader = factory.createXMLEventReader(sr); + + boolean sawUndef = false; + boolean sawDef = false; + + while (reader.hasNext()) { + XMLEvent event = reader.nextEvent(); + // System.out.println("Event: " + event); + if (event.isEntityReference()) { + EntityReference ref = (EntityReference) event; + if ("def".equals(ref.getName())) { + sawDef = true; + } else if ("undef".equals(ref.getName())) { + sawUndef = true; + } else { + throw new IllegalArgumentException("Unexpected entity name"); + } } } - } - Assert.assertEquals(true, sawDef); - Assert.assertEquals(true, sawUndef); - reader.close(); + Assert.assertEquals(true, sawDef); + Assert.assertEquals(true, sawUndef); + reader.close(); + }, new FilePermission("/tmp/this/does/not/exist/but/that/is/ok", "read")); } } --- old/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java 2016-07-18 00:51:18.808536272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java 2016-07-18 00:51:18.693593772 -0700 @@ -23,6 +23,7 @@ package stream.XMLEventReaderTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.testng.Assert; import java.io.ByteArrayInputStream; @@ -36,6 +37,7 @@ * @bug 6586466 * @summary Test XMLEventReader.nextTag() shall update internal event state. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6586466Test { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java 2016-07-18 00:51:19.236322272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java 2016-07-18 00:51:19.117381772 -0700 @@ -23,6 +23,7 @@ package stream.XMLEventReaderTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.testng.Assert; import javax.xml.namespace.QName; @@ -36,6 +37,7 @@ * @bug 6613059 * @summary Test XMLEventReader.nextTag() shall update internal event state, same as 6586466. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6613059Test { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java 2016-07-18 00:51:19.704088272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java 2016-07-18 00:51:19.586147271 -0700 @@ -30,12 +30,14 @@ import javax.xml.stream.XMLOutputFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6668115 * @summary Test XMLEventReader.getElementText() shall update last event even if no peek. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6668115Test { public java.io.File input; --- old/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java 2016-07-18 00:51:20.137871272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java 2016-07-18 00:51:20.017931272 -0700 @@ -26,12 +26,14 @@ import javax.xml.stream.XMLStreamException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6846133 * @summary Test method getDocumentTypeDeclaration() of DTD Event returns a valid value. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6846133Test { private static final String xml = "" + "

I am some simple html

"; --- old/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java 2016-07-18 00:51:20.580649771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java 2016-07-18 00:51:20.448715771 -0700 @@ -31,6 +31,7 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import com.sun.org.apache.xerces.internal.impl.XMLEntityManager; @@ -40,6 +41,7 @@ * @summary Test if method skipDTD of class XMLDTDScannerImpl will correctly skip the DTD section, * even if a call to XMLEntityScanner.scanData for skipping to the closing ']' returns true. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug8153781 { public static int DOCTYPE_SECTION_LENGTH = XMLEntityManager.DEFAULT_BUFFER_SIZE * 2; public static int DOCUMENT_LENGTH = DOCTYPE_SECTION_LENGTH + 4096; --- old/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java 2016-07-18 00:51:21.011434272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java 2016-07-18 00:51:20.889495272 -0700 @@ -32,11 +32,13 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLEventReader.getElementText() works after calling peek(). */ +@Listeners({jaxp.library.FilePolicy.class}) public class Issue40Test { public java.io.File input; --- old/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java 2016-07-18 00:51:21.446216772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java 2016-07-18 00:51:21.331274272 -0700 @@ -40,11 +40,13 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLEventWriter. */ +@Listeners({jaxp.library.FilePolicy.class}) public class ReaderToWriterTest { private static final XMLEventFactory XML_EVENT_FACTORY = XMLEventFactory.newInstance(); --- old/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java 2016-07-18 00:51:21.888995271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java 2016-07-18 00:51:21.764057771 -0700 @@ -36,11 +36,13 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLEventWriter. */ +@Listeners({jaxp.library.FilePolicy.class}) public class XMLEventWriterTest { /** --- old/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java 2016-07-18 00:51:22.330774272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java 2016-07-18 00:51:22.202838272 -0700 @@ -25,13 +25,17 @@ import javax.xml.stream.XMLInputFactory; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6756677 * @summary Test XMLInputFactory.newFactory(String factoryId, ClassLoader classLoader). */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6756677Test { @Test @@ -46,7 +50,6 @@ } catch (UnsupportedOperationException oe) { Assert.fail(oe.getMessage()); } - } // newFactory was added in StAX 1.2 @@ -63,7 +66,6 @@ } catch (UnsupportedOperationException oe) { Assert.fail(oe.getMessage()); } - } String Temp_Result = ""; --- old/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java 2016-07-18 00:51:22.789544772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java 2016-07-18 00:51:22.667605772 -0700 @@ -29,12 +29,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6909759 * @summary Test createXMLStreamReader with StreamSource. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6909759Test { --- old/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java 2016-07-18 00:51:23.224327272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java 2016-07-18 00:51:23.108385271 -0700 @@ -31,11 +31,13 @@ import javax.xml.transform.sax.SAXSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test createXMLEventReader from DOM or SAX source is unsupported. */ +@Listeners({jaxp.library.BasePolicy.class}) public class IssueTracker38 { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java 2016-07-18 00:51:23.661108771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java 2016-07-18 00:51:23.538170271 -0700 @@ -29,6 +29,7 @@ import javax.xml.transform.sax.SAXResult; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.helpers.DefaultHandler; @@ -36,6 +37,7 @@ * @bug 6846132 * @summary Test createXMLStreamWriter with SAXResult won't throw a NullPointerException. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6846132Test { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java 2016-07-18 00:51:24.093892272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java 2016-07-18 00:51:23.976950771 -0700 @@ -31,11 +31,13 @@ import javax.xml.transform.stream.StreamResult; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test the writing of duplicate namespace declarations when IS_REPAIRING_NAMESPACES is ture. */ +@Listeners({jaxp.library.BasePolicy.class}) public class DuplicateNSDeclarationTest { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java 2016-07-18 00:51:24.533672272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java 2016-07-18 00:51:24.414731771 -0700 @@ -32,12 +32,16 @@ import javax.xml.transform.stax.StAXResult; import javax.xml.transform.stream.StreamResult; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test create XMLWriter with variant Result. */ +@Listeners({jaxp.library.BasePolicy.class}) public class StreamResultTest { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java 2016-07-18 00:51:24.975451272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java 2016-07-18 00:51:24.850513771 -0700 @@ -34,11 +34,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLResolver. */ +@Listeners({jaxp.library.FilePolicy.class}) public class XMLResolverTest { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java 2016-07-18 00:51:25.395241271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java 2016-07-18 00:51:25.279299272 -0700 @@ -28,11 +28,13 @@ import javax.xml.stream.XMLStreamException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLStreamException contains the message of the wrapped exception. */ +@Listeners({jaxp.library.BasePolicy.class}) public class ExceptionTest { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java 2016-07-18 00:51:25.824026772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java 2016-07-18 00:51:25.701088271 -0700 @@ -30,12 +30,14 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6481615 * @summary Test Filtered XMLStreamReader can return the event type if current state is START_ELEMENT. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6481615 { static final String XML = "" + ""; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java 2016-07-18 00:51:26.252812271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java 2016-07-18 00:51:26.126875272 -0700 @@ -35,12 +35,14 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6481678 * @summary Test Filtered XMLStreamReader parses namespace correctly. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6481678 { String rootElement = "fruits"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java 2016-07-18 00:51:26.675600772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java 2016-07-18 00:51:26.556660272 -0700 @@ -30,11 +30,13 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test Filtered XMLStreamReader hasNext() always return the correct value if repeat to call it. */ +@Listeners({jaxp.library.FilePolicy.class}) public class HasNextTest { private static String INPUT_FILE = "HasNextTest.xml"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java 2016-07-18 00:51:27.106385271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java 2016-07-18 00:51:26.980448272 -0700 @@ -27,12 +27,14 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6218794 * @summary Test XMLStreamReader parses BOM UTF-8 and BOM UTF-16 big endian stream. */ +@Listeners({jaxp.library.FilePolicy.class}) public class BOMTest { // UTF-8 BOM test file private static final String INPUT_FILE1 = "UTF8-BOM.xml.data"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java 2016-07-18 00:51:27.527174772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java 2016-07-18 00:51:27.410233271 -0700 @@ -35,6 +35,7 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; @@ -42,6 +43,7 @@ * @bug 6388460 * @summary Test StAX parser can parse UTF-16 wsdl. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6388460 { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java 2016-07-18 00:51:27.955960272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java 2016-07-18 00:51:27.834021271 -0700 @@ -30,12 +30,14 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6472982 * @summary Test XMLStreamReader.getNamespaceContext().getPrefix("") won't throw IllegalArgumentException. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6472982Test { String namespaceURI = "foobar.com"; String rootElement = "foo"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java 2016-07-18 00:51:28.389743272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java 2016-07-18 00:51:28.263806271 -0700 @@ -29,12 +29,14 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6767322 * @summary Test XMLStreamReader.getVersion() returns null if a version isn't declared. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6767322Test { private static final String INPUT_FILE = "Bug6767322.xml"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java 2016-07-18 00:51:28.852511771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java 2016-07-18 00:51:28.723576272 -0700 @@ -23,6 +23,7 @@ package stream.XMLStreamReaderTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.testng.Assert; import java.io.StringReader; @@ -34,6 +35,7 @@ * @bug 6847819 * @summary Test StAX parser shall throw XMLStreamException for illegal xml declaration. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6847819Test { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java 2016-07-18 00:51:29.280297771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java 2016-07-18 00:51:29.160357771 -0700 @@ -30,11 +30,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test StAX parser can parse xml without declaration. */ +@Listeners({jaxp.library.BasePolicy.class}) public class BugTest { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java 2016-07-18 00:51:29.710082770 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java 2016-07-18 00:51:29.588143771 -0700 @@ -34,11 +34,13 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test StAX parses namespace and attribute. */ +@Listeners({jaxp.library.FilePolicy.class}) public class DefaultAttributeTest { private static final String INPUT_FILE = "ExternalDTD.xml"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java 2016-07-18 00:51:30.139867772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java 2016-07-18 00:51:30.020927272 -0700 @@ -30,11 +30,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test double namespaces and nested namespaces. */ +@Listeners({jaxp.library.BasePolicy.class}) public class DoubleXmlnsTest { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java 2016-07-18 00:51:30.572651272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java 2016-07-18 00:51:30.449712772 -0700 @@ -28,12 +28,14 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6440324 * @summary Test StAX can accept non-existent DTD if IS_VALIDATING if false. */ +@Listeners({jaxp.library.FilePolicy.class}) public class IsValidatingTest { /** --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java 2016-07-18 00:51:30.995439771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java 2016-07-18 00:51:30.880497271 -0700 @@ -27,12 +27,14 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6631262 * @summary Test XMLStreamReader.getName() shall throw IllegalStateException if current event is not start/end element. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Issue44Test { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java 2016-07-18 00:51:31.430222271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java 2016-07-18 00:51:31.312281271 -0700 @@ -30,12 +30,14 @@ import org.testng.Assert; import org.testng.AssertJUnit; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6631265 * @summary Test XMLStreamReader.standaloneSet() presents if input document has a value for "standalone" attribute in xml declaration. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Issue47Test { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java 2016-07-18 00:51:31.855009772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java 2016-07-18 00:51:31.737068772 -0700 @@ -29,11 +29,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test no prefix is represented by "", not null. */ +@Listeners({jaxp.library.BasePolicy.class}) public class IssueTracker24 { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java 2016-07-18 00:51:32.285794271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java 2016-07-18 00:51:32.167853271 -0700 @@ -30,11 +30,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test StAX parse xsd document including external DTD. */ +@Listeners({jaxp.library.FilePolicy.class}) public class IssueTracker35 { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java 2016-07-18 00:51:32.709582271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java 2016-07-18 00:51:32.590641771 -0700 @@ -31,11 +31,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test it can retrieve attribute with null or empty name space. */ +@Listeners({jaxp.library.FilePolicy.class}) public class IssueTracker70 { static private final File testFile = new File(IssueTracker70.class.getResource("IssueTracker70.xml").getFile()); --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java 2016-07-18 00:51:33.147363272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java 2016-07-18 00:51:33.018427771 -0700 @@ -28,11 +28,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLStreamReader parses namespace declaration within element when NamespaceAware turns off and on. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Jsr173MR1Req5Test { private static final String INPUT_FILE1 = "Jsr173MR1Req5.xml"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java 2016-07-18 00:51:33.571151272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java 2016-07-18 00:51:33.455209271 -0700 @@ -28,11 +28,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLStreamReader parses attribute with namespace aware. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Jsr173MR1Req8Test { private static final String INPUT_FILE1 = "Jsr173MR1Req8.xml"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java 2016-07-18 00:51:34.001935771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java 2016-07-18 00:51:33.878997272 -0700 @@ -32,11 +32,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test StAX parser processes namespace. */ +@Listeners({jaxp.library.BasePolicy.class}) public class NamespaceTest { String namespaceURI = "foobar.com"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java 2016-07-18 00:51:34.431720771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java 2016-07-18 00:51:34.307782771 -0700 @@ -28,11 +28,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLStreamReader.hasName() returns false for ENTITY_REFERENCE. */ +@Listeners({jaxp.library.FilePolicy.class}) public class StreamReaderTest { /** --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java 2016-07-18 00:51:34.853509772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java 2016-07-18 00:51:34.733569771 -0700 @@ -38,6 +38,7 @@ import javax.xml.stream.events.XMLEvent; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* @@ -72,6 +73,7 @@ * The current jaxp implementation actually throws a nullpointexception. A better error message could be used. * */ +@Listeners({jaxp.library.FilePolicy.class}) public class SupportDTDTest { final boolean DEBUG = false; final String _file = "ExternalDTD.xml"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java 2016-07-18 00:51:35.272300271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java 2016-07-18 00:51:35.155358771 -0700 @@ -27,11 +27,13 @@ import javax.xml.stream.XMLStreamReader; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test parsing Voice XML DTD. */ +@Listeners({jaxp.library.FilePolicy.class}) public class VoiceXMLDTDTest { private static final String INPUT_FILE1 = "voicexml.xml"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java 2016-07-18 00:51:35.708082271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java 2016-07-18 00:51:35.595138771 -0700 @@ -27,11 +27,13 @@ import javax.xml.stream.XMLInputFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test parsing xml 1.1. */ +@Listeners({jaxp.library.FilePolicy.class}) public class XML11Test { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java 2016-07-18 00:51:36.130870772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java 2016-07-18 00:51:36.009931272 -0700 @@ -34,6 +34,7 @@ import javax.xml.stream.XMLStreamWriter; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -41,6 +42,7 @@ /* * @summary Test XMLStreamWriter shall escape the illegal characters. */ +@Listeners({jaxp.library.BasePolicy.class}) public class AttributeEscapeTest { /** --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java 2016-07-18 00:51:36.562654771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java 2016-07-18 00:51:36.445713272 -0700 @@ -31,12 +31,14 @@ import javax.xml.stream.XMLStreamWriter; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6452107 * @summary Test StAX can write ISO-8859-1 encoding XML. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6452107 { /** --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java 2016-07-18 00:51:36.993439272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java 2016-07-18 00:51:36.873499271 -0700 @@ -29,12 +29,14 @@ import javax.xml.stream.XMLStreamWriter; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6600882 * @summary Test toString(), hashCode() of XMLStreamWriter . */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6600882Test { --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java 2016-07-18 00:51:37.416227772 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java 2016-07-18 00:51:37.298286771 -0700 @@ -30,6 +30,7 @@ import javax.xml.stream.XMLStreamWriter; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import util.BaseStAXUT; @@ -38,6 +39,7 @@ * @bug 6675332 * @summary Test XMLStreamWriter writeAttribute when IS_REPAIRING_NAMESPACES is true. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6675332Test extends BaseStAXUT { private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance(); --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java 2016-07-18 00:51:37.834018771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java 2016-07-18 00:51:37.719076271 -0700 @@ -30,12 +30,14 @@ import javax.xml.transform.stream.StreamResult; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 7037352 * @summary Test XMLStreamWriter.getNamespaceContext().getPrefix with XML_NS_URI and XMLNS_ATTRIBUTE_NS_URI. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug7037352Test { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java 2016-07-18 00:51:38.267801771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java 2016-07-18 00:51:38.150860272 -0700 @@ -41,6 +41,7 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -49,10 +50,10 @@ /* * @summary Test XMLStreamWriter writes a soap message. */ +@Listeners({jaxp.library.FilePolicy.class}) public class DomUtilTest { private XMLOutputFactory staxOut; - final File folder = new File(System.getProperty("tempdir") + "/classes/soapmessages"); private static final String INPUT_FILE1 = "message_12.xml"; public void setup() { --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java 2016-07-18 00:51:38.684593271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java 2016-07-18 00:51:38.566652272 -0700 @@ -29,11 +29,13 @@ import javax.xml.stream.XMLStreamWriter; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLStreamWriter writes namespace and attribute after writeEmptyElement. */ +@Listeners({jaxp.library.BasePolicy.class}) public class EmptyElementTest { // expected output --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java 2016-07-18 00:51:39.513178771 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java 2016-07-18 00:51:39.344263272 -0700 @@ -29,11 +29,13 @@ import javax.xml.stream.XMLStreamWriter; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLStreamWriter writes a document with encoding setting. */ +@Listeners({jaxp.library.BasePolicy.class}) public class EncodingTest { private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance(); --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java 2016-07-18 00:51:39.967951271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java 2016-07-18 00:51:39.843013771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,11 +32,13 @@ import org.testng.Assert; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test the writing of Namespaces. */ +@Listeners({jaxp.library.BasePolicy.class}) public class NamespaceTest { /** debug output? */ --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java 2016-07-18 00:51:40.421724271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java 2016-07-18 00:51:40.293788272 -0700 @@ -28,12 +28,14 @@ import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamWriter; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6391922 * @summary Test XMLStreamWriter can writeDefaultNamespace(null). */ +@Listeners({jaxp.library.BasePolicy.class}) public class NullUriDetectionTest { @Test public void test1() throws Exception { --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java 2016-07-18 00:51:40.875497272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java 2016-07-18 00:51:40.751559272 -0700 @@ -29,11 +29,13 @@ import javax.xml.stream.XMLStreamWriter; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLStreamWriter can output multiple declarations if IS_REPAIRING_NAMESPACES is false. */ +@Listeners({jaxp.library.BasePolicy.class}) public class SqeLinuxTest { // note that expected output will have multiple declarations, --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java 2016-07-18 00:51:41.321274271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java 2016-07-18 00:51:41.191339271 -0700 @@ -38,6 +38,7 @@ import javax.xml.stream.XMLStreamWriter; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.testng.annotations.DataProvider; @@ -49,6 +50,7 @@ * used within element text */ +@Listeners({jaxp.library.BasePolicy.class}) public class SurrogatesTest { // Test that valid surrogate characters can be written/readen by xml stream --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java 2016-07-18 00:51:41.777046271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java 2016-07-18 00:51:41.643113271 -0700 @@ -28,12 +28,14 @@ import javax.xml.stream.XMLStreamWriter; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6394074 * @summary Test XMLStreamWriter namespace prefix with writeDefaultNamespace. */ +@Listeners({jaxp.library.BasePolicy.class}) public class UnprefixedNameTest { @Test --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java 2016-07-18 00:51:42.214827271 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java 2016-07-18 00:51:42.096886271 -0700 @@ -40,11 +40,13 @@ import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XMLStreamWriter functionality. */ +@Listeners({jaxp.library.FilePolicy.class}) public class WriterTest { final String ENCODING = "UTF-8"; --- old/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java 2016-07-18 00:51:42.656606272 -0700 +++ new/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java 2016-07-18 00:51:42.537665771 -0700 @@ -31,12 +31,14 @@ import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6347190 * @summary Test StAX Writer won't insert comment into element inside. */ +@Listeners({jaxp.library.BasePolicy.class}) public class XMLStreamWriterTest { @BeforeMethod --- old/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java 2016-07-18 00:51:43.116376271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java 2016-07-18 00:51:42.986441272 -0700 @@ -37,6 +37,7 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.helpers.DefaultHandler; @@ -45,6 +46,7 @@ * @bug 4693341 * @summary Test transform with external dtd. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4693341Test { // save dtd file to current working directory to avoid writing into source repository public void copyDTDtoWorkDir() throws IOException { --- old/test/javax/xml/jaxp/unittest/transform/Bug4892774.java 2016-07-18 00:51:43.577145772 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug4892774.java 2016-07-18 00:51:43.449209771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -36,6 +36,7 @@ import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import transform.util.DOMUtil; @@ -48,6 +49,7 @@ * @summary Test identity transformer with all possible types of Source and Result combinations for doucment version and encoding information. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4892774 { private final String XML_FILE = "catalog.xml"; --- old/test/javax/xml/jaxp/unittest/transform/Bug5073477.java 2016-07-18 00:51:44.021923271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug5073477.java 2016-07-18 00:51:43.895986271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.dom.DOMResult; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -34,6 +35,7 @@ * @bug 5073477 * @summary Test DOMResult.setNextSibling works correctly. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug5073477 { @Test --- old/test/javax/xml/jaxp/unittest/transform/Bug6175602.java 2016-07-18 00:51:44.456705771 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6175602.java 2016-07-18 00:51:44.334766771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,12 +29,14 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamSource; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6175602 * @summary Test compilation of MsWordXMLImport.xsl. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6175602 { public Bug6175602() { --- old/test/javax/xml/jaxp/unittest/transform/Bug6206491.java 2016-07-18 00:51:44.888489771 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6206491.java 2016-07-18 00:51:44.770548771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -39,6 +39,7 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -48,6 +49,7 @@ * @bug 6206491 * @summary Test key searches over more than one document. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6206491 { private String getResource(String s) { --- old/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java 2016-07-18 00:51:45.328269771 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java 2016-07-18 00:51:45.195336271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,12 +32,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6216226 * @summary Test StreamResult(File) is closed after transform(). */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6216226Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/Bug6311448.java 2016-07-18 00:51:45.769049271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6311448.java 2016-07-18 00:51:45.646110771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.transform.stream.StreamResult; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -41,6 +42,7 @@ * @bug 6311448 * @summary Test XML transformer can output Unicode surrorate pair. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6311448 { @Test --- old/test/javax/xml/jaxp/unittest/transform/Bug6384805.java 2016-07-18 00:51:46.208829271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6384805.java 2016-07-18 00:51:46.081892772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -35,12 +35,14 @@ import javax.xml.xpath.XPathFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6384805 * @summary Test XSLTC can parse XML namespace when nodeset is created within a template. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6384805 { @Test --- old/test/javax/xml/jaxp/unittest/transform/Bug6465722.java 2016-07-18 00:51:46.672597271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6465722.java 2016-07-18 00:51:46.544661272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -34,6 +34,7 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -41,6 +42,7 @@ * @bug 6465722 * @summary Test Transformer can transform the node attribute prefixed with a namespace. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6465722 { public Bug6465722(String name) { --- old/test/javax/xml/jaxp/unittest/transform/Bug6467808.java 2016-07-18 00:51:47.124371272 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6467808.java 2016-07-18 00:51:47.003431771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -33,12 +33,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6467808 * @summary Test Transformer can parse re-declare prefixed namespace mappings. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6467808 { private static final String TESTXML = "\n" --- old/test/javax/xml/jaxp/unittest/transform/Bug6490380.java 2016-07-18 00:51:47.582142271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6490380.java 2016-07-18 00:51:47.448209272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,12 +32,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6490380 * @summary Test only a single DOCTYPE declaration is generated through transforming. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6490380 { @Test --- old/test/javax/xml/jaxp/unittest/transform/Bug6490921.java 2016-07-18 00:51:48.021922271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6490921.java 2016-07-18 00:51:47.897984271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -36,7 +36,10 @@ import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.stream.StreamResult; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -46,6 +49,7 @@ * @bug 6490921 * @summary Test property org.xml.sax.driver is always applied in transformer API. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6490921 { public static class ReaderStub extends XMLFilterImpl { --- old/test/javax/xml/jaxp/unittest/transform/Bug6513892.java 2016-07-18 00:51:48.471697272 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6513892.java 2016-07-18 00:51:48.348758772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -34,6 +34,7 @@ import org.testng.Assert; import org.testng.annotations.BeforeClass; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -41,6 +42,7 @@ * @bug 6513892 * @summary Test the output encoding of the transform is the same as that of the redirect extension. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6513892 { @BeforeClass public void setup(){ --- old/test/javax/xml/jaxp/unittest/transform/Bug6537167.java 2016-07-18 00:51:48.965450271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6537167.java 2016-07-18 00:51:48.834515771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,12 +32,14 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6537167 * @summary Test transforming for particular xsl files. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6537167 { @Test --- old/test/javax/xml/jaxp/unittest/transform/Bug6540545.java 2016-07-18 00:51:49.597134272 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6540545.java 2016-07-18 00:51:49.419223271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,12 +31,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6540545 * @summary Test XSLT as expected. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6540545 { @Test --- old/test/javax/xml/jaxp/unittest/transform/Bug6559595.java 2016-07-18 00:51:50.039912771 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6559595.java 2016-07-18 00:51:49.915974772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -35,12 +35,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6559595 * @summary Test ampersand in href attribute is not handled specially even if output is set to HTML. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6559595 { @Test --- old/test/javax/xml/jaxp/unittest/transform/Bug6565260.java 2016-07-18 00:51:50.494685271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6565260.java 2016-07-18 00:51:50.369747772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,12 +31,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6565260 * @summary Test use-attribute-sets attribute is not used for the root node. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6565260 { @Test --- old/test/javax/xml/jaxp/unittest/transform/Bug6940416.java 2016-07-18 00:51:50.953455771 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6940416.java 2016-07-18 00:51:50.829517771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -39,12 +39,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6940416 * @summary Test transforming correctly. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6940416 { @Test --- old/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java 2016-07-18 00:51:51.396234271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java 2016-07-18 00:51:51.275294772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -43,12 +43,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6935697 * @summary Test Transformer can compile large xsl file. */ +@Listeners({jaxp.library.FilePolicy.class}) public class BugDB12665704Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java 2016-07-18 00:51:51.974944772 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java 2016-07-18 00:51:51.792036272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -37,12 +37,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6401137 * @summary Test transform certain xsl. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR6401137Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java 2016-07-18 00:51:52.578642771 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java 2016-07-18 00:51:52.451706272 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -24,6 +24,7 @@ package transform; import java.io.File; +import java.io.FilePermission; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -32,7 +33,10 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -41,48 +45,46 @@ * @bug 6551600 * @summary Test using UNC path as StreamResult. */ +@Listeners({ jaxp.library.BasePolicy.class }) public class CR6551600Test { @Test public final void testUNCPath() { - String hostName = ""; - try { - hostName = java.net.InetAddress.getLocalHost().getHostName(); - } catch (java.net.UnknownHostException e) { - // falls through - } - - String path = "\\\\" + hostName + "\\C$\\xslt_unc_test.xml"; - String os = System.getProperty("os.name"); - if (os.indexOf("Windows") < 0) { - path = "///tmp/test.xml"; - } - else { - policy.PolicyUtil.changePolicy(getClass().getResource("CR6551600.policy").getFile()); - } - - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - Document doc = builder.newDocument(); - Element root = doc.createElement("test"); - doc.appendChild(root); - // create an identity transform - Transformer t = TransformerFactory.newInstance().newTransformer(); - File f = new File(path); - StreamResult result = new StreamResult(f); - DOMSource source = new DOMSource(doc); - System.out.println("Writing to " + f); - t.transform(source, result); - } catch (Exception e) { - // unexpected failure - e.printStackTrace(); - Assert.fail(e.toString()); - } - - File file = new File(path); - if (file.exists()) { - file.deleteOnExit(); - } + boolean isWindows = System.getProperty("os.name").contains("Windows"); + JAXPTestUtilities.runWithTmpPermission(() -> { + String hostName = ""; + try { + hostName = java.net.InetAddress.getLocalHost().getHostName(); + } catch (java.net.UnknownHostException e) { + // falls through + } + + String path = isWindows ? "\\\\" + hostName + "\\C$\\xslt_unc_test.xml" : "///tmp/test.xml"; + + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document doc = builder.newDocument(); + Element root = doc.createElement("test"); + doc.appendChild(root); + // create an identity transform + Transformer t = TransformerFactory.newInstance().newTransformer(); + File f = new File(path); + StreamResult result = new StreamResult(f); + DOMSource source = new DOMSource(doc); + System.out.println("Writing to " + f); + t.transform(source, result); + } catch (Exception e) { + // unexpected failure + e.printStackTrace(); + Assert.fail(e.toString()); + } + + File file = new File(path); + if (file.exists()) { + file.deleteOnExit(); + } + }, isWindows ? new FilePermission("//localhost/C$/xslt_unc_test.xml", "read, write, delete") + : new FilePermission("///tmp/test.xml", "read, write, delete")); } } --- old/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java 2016-07-18 00:51:53.018422772 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java 2016-07-18 00:51:52.888487772 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,12 +30,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6577667 * @summary Test XSLT can parse statement "not(preceding-sibling::* or following-sibling::*)" in stylesheet file. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR6577667Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java 2016-07-18 00:51:53.458202771 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java 2016-07-18 00:51:53.338262771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -40,6 +41,7 @@ * @bug 6652519 * @summary Test transfoming from StreamSource to DOMResult. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR6652519Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java 2016-07-18 00:51:53.903979771 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java 2016-07-18 00:51:53.778042771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,12 +30,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6689809 * @summary Test Transformer can handle XPath predicates in xsl:key elements. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR6689809Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java 2016-07-18 00:51:54.332765271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java 2016-07-18 00:51:54.209826771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,12 +32,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6905829 * @summary Test XSLT can parse certain xsl. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR6905829Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java 2016-07-18 00:51:54.781540772 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java 2016-07-18 00:51:54.656603271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -34,12 +34,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6935697 * @summary Test XSLT can parse the certain xsl. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR6935697Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java 2016-07-18 00:51:55.225363547 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java 2016-07-18 00:51:55.101400870 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,12 +32,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6941869 * @summary Test XSLT evaluate "count(.|key('props', d/e)[1])" correctly. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR6941869Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java 2016-07-18 00:51:55.674228397 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java 2016-07-18 00:51:55.540268731 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -39,12 +39,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6957215 * @summary Test XSLT generates the element content using xsl:attribute instructions. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR6957215Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java 2016-07-18 00:51:56.117130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java 2016-07-18 00:51:55.995131776 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -34,12 +34,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 7098746 * @summary Test transforming as expected. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR7098746Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java 2016-07-18 00:51:56.559130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java 2016-07-18 00:51:56.432130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -23,6 +23,7 @@ package transform; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.testng.Assert; @@ -48,6 +49,7 @@ /* * @summary Test DOMResult. */ +@Listeners({jaxp.library.FilePolicy.class}) public class DOMResultTest { @Test --- old/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java 2016-07-18 00:51:56.988130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java 2016-07-18 00:51:56.867130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -30,6 +30,7 @@ public static String test(NodeList list) { Node node = list.item(0); - return "["+node.getNodeName() + ":" + node.getTextContent()+"]"; + return "[".concat(node.getNodeName()).concat(":").concat(node.getTextContent()).concat("]"); + //return "["+node.getNodeName() + ":" + node.getTextContent()+"]"; } } --- old/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java 2016-07-18 00:51:57.415130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java 2016-07-18 00:51:57.298130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,38 +28,43 @@ import javax.xml.transform.TransformerFactory; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.annotations.Test; /* * @summary Test creating TransformerFactory with ContextClassLoader. */ +@Test(singleThreaded=true) public class FactoryFindTest { boolean myClassLoaderUsed = false; - @Test - public void testFactoryFind() { - try { - // System.setProperty("jaxp.debug", "true"); - - TransformerFactory factory = TransformerFactory.newInstance(); - Assert.assertTrue(factory.getClass().getClassLoader() == null); - - Thread.currentThread().setContextClassLoader(null); - factory = TransformerFactory.newInstance(); - Assert.assertTrue(factory.getClass().getClassLoader() == null); - - Thread.currentThread().setContextClassLoader(new MyClassLoader()); - factory = TransformerFactory.newInstance(); - if (System.getSecurityManager() == null) - Assert.assertTrue(myClassLoaderUsed); - else - Assert.assertFalse(myClassLoaderUsed); - } catch (Exception ex) { - Assert.fail(ex.toString()); - } + public void runWithSecurityManager() throws Exception { + JAXPTestUtilities.tryRunWithPolicyManager(() -> testFactoryFind()); + } + + public void runWithoutSecurityManager() throws Exception { + testFactoryFind(); + } + + private void testFactoryFind() throws Exception { + // System.setProperty("jaxp.debug", "true"); + + TransformerFactory factory = TransformerFactory.newInstance(); + Assert.assertTrue(factory.getClass().getClassLoader() == null); + Thread.currentThread().setContextClassLoader(null); + factory = TransformerFactory.newInstance(); + Assert.assertTrue(factory.getClass().getClassLoader() == null); + + Thread.currentThread().setContextClassLoader(new MyClassLoader()); + factory = TransformerFactory.newInstance(); + if (System.getSecurityManager() == null) + Assert.assertTrue(myClassLoaderUsed); + else + Assert.assertFalse(myClassLoaderUsed); } class MyClassLoader extends URLClassLoader { --- old/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java 2016-07-18 00:51:58.246130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java 2016-07-18 00:51:58.074130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,12 +31,14 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6905829 * @summary Test XSLT can work against the certain xsl. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Issue2204Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java 2016-07-18 00:51:58.859130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java 2016-07-18 00:51:58.691130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -41,11 +41,13 @@ import org.w3c.dom.DocumentFragment; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test XSL extension for RTF works, for https://issues.apache.org/jira/i#browse/XALANJ-2290. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Issue2290Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java 2016-07-18 00:51:59.510130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java 2016-07-18 00:51:59.304130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.transform.stream.StreamResult; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -39,6 +40,7 @@ * @bug 6883209 * @summary Test XSLT won't cause StackOverflow when it handle many characters. */ +@Listeners({jaxp.library.BasePolicy.class}) public class OpenJDK100017Test { @Test --- old/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java 2016-07-18 00:52:00.128130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java 2016-07-18 00:51:59.954130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -47,6 +48,7 @@ /* * @summary Test Transforming from SAX to DOM. */ +@Listeners({jaxp.library.FilePolicy.class}) public class SAX2DOMTest { @Test --- old/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java 2016-07-18 00:52:00.775130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java 2016-07-18 00:52:00.584130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -23,14 +23,11 @@ package transform; -import java.io.IOException; +import java.io.FilePermission; import java.io.InputStream; import java.io.StringWriter; import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; @@ -38,30 +35,27 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.annotations.Test; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; /* * @summary Test XSLT shall report TransformerException for unsafe xsl when FEATURE_SECURE_PROCESSING is true. */ +@Test(singleThreaded = true) public class SecureProcessingTest { - static boolean _isSecureMode = false; - static { - if (System.getSecurityManager() != null) { - _isSecureMode = true; - System.out.println("Security Manager is present"); - } else { - System.out.println("Security Manager is NOT present"); - } + public void runWithSecurityManager() throws Exception { + JAXPTestUtilities.tryRunWithPolicyManager(() -> testSecureProcessing(), + new FilePermission(System.getProperty("test.src") + "/-", "read")); } + public void runWithoutSecurityManager() throws Exception { + testSecureProcessing(); + } - - @Test - public final void testSecureProcessing() { - + private final void testSecureProcessing() { + boolean _isSecureMode = System.getSecurityManager() != null; // SECURE_PROCESSING == false // the style sheet --- old/test/javax/xml/jaxp/unittest/transform/SourceTest.java 2016-07-18 00:52:01.417130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/SourceTest.java 2016-07-18 00:52:01.230130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -35,11 +35,13 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test Sources. */ +@Listeners({jaxp.library.FilePolicy.class}) public class SourceTest { @Test --- old/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java 2016-07-18 00:52:02.074130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java 2016-07-18 00:52:01.899130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -40,11 +40,13 @@ import javax.xml.transform.stax.StAXSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test parsing from StAXSource. */ +@Listeners({jaxp.library.FilePolicy.class}) public class StAXSourceTest { @Test --- old/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java 2016-07-18 00:52:02.714130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java 2016-07-18 00:52:02.535130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -29,11 +29,13 @@ import javax.xml.transform.*; import javax.xml.transform.stream.StreamSource; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary This class contains tests for Templates. */ +@Listeners({jaxp.library.BasePolicy.class}) public class TemplatesTest { /** --- old/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java 2016-07-18 00:52:03.262130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java 2016-07-18 00:52:03.140130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -42,6 +42,7 @@ import javax.xml.transform.stream.StreamSource; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -49,6 +50,7 @@ /* * @summary Test TransformerFactory. */ +@Listeners({jaxp.library.FilePolicy.class}) public class TransformerFactoryTest { private static URIResolver resolver = new URIResolver() { --- old/test/javax/xml/jaxp/unittest/transform/TransformerTest.java 2016-07-18 00:52:03.726130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/TransformerTest.java 2016-07-18 00:52:03.592130271 -0700 @@ -23,9 +23,6 @@ package transform; -import com.sun.org.apache.xml.internal.serialize.OutputFormat; -import com.sun.org.apache.xml.internal.serialize.XMLSerializer; - import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.File; @@ -43,8 +40,11 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.AssertJUnit; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -60,10 +60,14 @@ import org.xml.sax.XMLReader; import org.xml.sax.helpers.AttributesImpl; +import com.sun.org.apache.xml.internal.serialize.OutputFormat; +import com.sun.org.apache.xml.internal.serialize.XMLSerializer; + /* * @summary Transformer Tests * @bug 6272879 6305029 6505031 8150704 */ +@Listeners({jaxp.library.FilePolicy.class}) public class TransformerTest { private Transformer createTransformer() throws TransformerException { return TransformerFactory.newInstance().newTransformer(); --- old/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java 2016-07-18 00:52:04.205130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java 2016-07-18 00:52:04.084130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java 2016-07-18 00:52:04.690130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java 2016-07-18 00:52:04.573130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java 2016-07-18 00:52:05.173130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java 2016-07-18 00:52:05.049130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java 2016-07-18 00:52:05.625130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java 2016-07-18 00:52:05.508130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -35,6 +35,7 @@ import javax.xml.transform.stream.StreamSource; import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import static org.testng.Assert.assertEquals; @@ -43,6 +44,7 @@ * @summary This class contains tests for XSLT functions. */ +@Listeners({jaxp.library.BasePolicy.class}) public class XSLTFunctionsTest { /** @@ -65,6 +67,7 @@ // Create factory and transformer TransformerFactory tf = TransformerFactory.newInstance(); + tf.setFeature("http://www.oracle.com/xml/jaxp/properties/enableExtensionFunctions", true); Transformer t = tf.newTransformer( xslsrc ); t.setErrorListener(tf.getErrorListener()); --- old/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java 2016-07-18 00:52:06.066130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java 2016-07-18 00:52:05.945130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.transform.sax.TransformerHandler; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.helpers.AttributesImpl; @@ -37,6 +38,7 @@ * @bug 6451633 * @summary Test TransformerHandler ignores empty text node. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6451633 { @Test --- old/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java 2016-07-18 00:52:06.517130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java 2016-07-18 00:52:06.401130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java 2016-07-18 00:52:06.975130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java 2016-07-18 00:52:06.858130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java 2016-07-18 00:52:07.446130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java 2016-07-18 00:52:07.322130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java 2016-07-18 00:52:07.916130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java 2016-07-18 00:52:07.794130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/transform/util/TransformerUtil.java 2016-07-18 00:52:08.395130271 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/util/TransformerUtil.java 2016-07-18 00:52:08.272130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java 2016-07-18 00:52:08.875130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java 2016-07-18 00:52:08.744130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -35,10 +35,12 @@ import javax.xml.validation.Validator; import org.testng.annotations.BeforeClass; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; +@Listeners({jaxp.library.FilePolicy.class}) public class AnyElementTest { @BeforeClass public void setup() throws URISyntaxException, SAXException { --- old/test/javax/xml/jaxp/unittest/validation/Bug4966232.java 2016-07-18 00:52:09.334130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug4966232.java 2016-07-18 00:52:09.196130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -38,6 +39,7 @@ * @bug 4966232 * @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource & SAXSource. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4966232 { // test for W3C XML Schema 1.0 - newSchema(Source schema) --- old/test/javax/xml/jaxp/unittest/validation/Bug4966254.java 2016-07-18 00:52:09.833130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug4966254.java 2016-07-18 00:52:09.713130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -38,6 +39,7 @@ * @bug 4966254 * @summary Test validate(StreamSource) & validate(StreamSource,null) works instead of throws IOException. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug4966254 { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; --- old/test/javax/xml/jaxp/unittest/validation/Bug4969042.java 2016-07-18 00:52:10.264130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug4969042.java 2016-07-18 00:52:10.146130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -34,6 +34,7 @@ import javax.xml.validation.ValidatorHandler; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -45,6 +46,7 @@ * @summary Test ValidationHandler shall invoke ignorableWhitespace() of the * user-defined ContentHandler once the validator detects any ignorable whitespaces. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug4969042 { public static final String XSD = "\n" + "" + "CheetahTech" @@ -59,21 +62,17 @@ private static final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); @Test - public void test() { - try { - final Schema sc = factory.newSchema(writeSchema()); - final Validator validator = sc.newValidator(); - validator.validate(new StreamSource(new StringReader(xml))); - validator.validate(new StreamSource(new StringReader(xml))); - validator.validate(new StreamSource(new StringReader(xml))); - validator.validate(new StreamSource(new StringReader(xml))); - } catch (Throwable ex) { - Assert.fail("Exception: " + ex.getMessage()); - } + public void test() throws Exception { + final Schema sc = factory.newSchema(writeSchema()); + final Validator validator = sc.newValidator(); + validator.validate(new StreamSource(new StringReader(xml))); + validator.validate(new StreamSource(new StringReader(xml))); + validator.validate(new StreamSource(new StringReader(xml))); + validator.validate(new StreamSource(new StringReader(xml))); } private File writeSchema() throws IOException { - final File rtn = File.createTempFile("scheam", "xsd"); + final File rtn = File.createTempFile("scheam", "xsd", Paths.get("").toAbsolutePath().toFile()); final OutputStream out = new FileOutputStream(rtn); final OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); writer.write(schema); --- old/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java 2016-07-18 00:52:22.577130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java 2016-07-18 00:52:22.456130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -43,6 +43,7 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -51,6 +52,7 @@ * @bug 6467424 * @summary Test Validator augments the default delement value if feature element-default is on. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6467424Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/Bug6483188.java 2016-07-18 00:52:23.028130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug6483188.java 2016-07-18 00:52:22.899130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -23,6 +23,7 @@ package validation; +import java.io.FilePermission; import java.net.URL; import javax.xml.XMLConstants; @@ -30,6 +31,8 @@ import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.annotations.Test; import org.xml.sax.SAXParseException; @@ -38,22 +41,26 @@ * @bug 6483188 * @summary Test Schema Validator can handle element with having large maxOccurs, but doesn't accept sequence with having large maxOccurs in FEATURE_SECURE_PROCESSING mode. */ +@Test(singleThreaded = true) public class Bug6483188 { - static boolean _isSecureMode = false; - static { - if (System.getSecurityManager() != null) { - _isSecureMode = true; - System.out.println("Security Manager is present"); - } else { - System.out.println("Security Manager is NOT present"); - } + SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + + public void runWithSecurityManager() throws Exception { + JAXPTestUtilities.tryRunWithPolicyManager(() -> { + testLargeElementNoSecurity(); + testLargeElementWithSecurity(); + testLargeSequenceWithSecurity(); + }, new FilePermission(System.getProperty("test.src") + "/-", "read")); } - SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + public void runWithoutSecurityManager() throws Exception { + testLargeElementNoSecurity(); + testLargeElementWithSecurity(); + testLargeSequenceWithSecurity(); + } - @Test - public void testLargeElementNoSecurity() { - if (_isSecureMode) + private void testLargeElementNoSecurity() { + if (System.getSecurityManager() != null) return; // jaxp secure feature can not be turned off when security // manager is present try { @@ -66,8 +73,7 @@ } } - @Test - public void testLargeElementWithSecurity() { + private void testLargeElementWithSecurity() { try { sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); URL url = getClass().getResource("test-element.xsd"); @@ -78,8 +84,7 @@ } } - @Test - public void testLargeSequenceWithSecurity() { + private void testLargeSequenceWithSecurity() { try { sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); URL url = getClass().getResource("test-sequence.xsd"); --- old/test/javax/xml/jaxp/unittest/validation/Bug6493687.java 2016-07-18 00:52:23.484130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug6493687.java 2016-07-18 00:52:23.364130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -23,6 +23,7 @@ package validation; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -30,6 +31,7 @@ * @bug 6493687 * @summary Test validator.validate(new DOMSource(node)) without any exception. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6493687 { @Test --- old/test/javax/xml/jaxp/unittest/validation/Bug6509668.java 2016-07-18 00:52:23.907130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug6509668.java 2016-07-18 00:52:23.792130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -36,6 +36,7 @@ import javax.xml.validation.ValidatorHandler; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.TypeInfo; import org.xml.sax.Attributes; @@ -48,6 +49,7 @@ * @bug 6509668 * @summary Test TypeInfoProvider.getElementTypeInfo() for union type when startElement and endElement. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6509668 { public static final String XSD = "\n" + "\n" --- old/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java 2016-07-18 00:52:25.234130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java 2016-07-18 00:52:25.108130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -35,6 +35,7 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -43,6 +44,7 @@ * @bug 6695843 * @summary Test Validator should report accurate element type if there is a violation on a complexType with simpleContent that extends a base complexType. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6695843Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java 2016-07-18 00:52:25.670130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java 2016-07-18 00:52:25.551130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -43,7 +43,7 @@ import javax.xml.validation.Validator; import org.testng.Assert; -import org.testng.annotations.BeforeClass; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.xml.sax.ErrorHandler; @@ -54,6 +54,7 @@ * @bug 6773084 * @summary Test Schema object is thread safe. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6773084Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; @@ -68,11 +69,6 @@ private static Schema schema; - @BeforeClass - public void setup(){ - policy.PolicyUtil.changePolicy(getClass().getResource("6773084.policy").getFile()); - } - @Test public void test() throws Exception { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); --- old/test/javax/xml/jaxp/unittest/validation/Bug6859210.java 2016-07-18 00:52:26.113130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug6859210.java 2016-07-18 00:52:25.994130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -41,6 +42,7 @@ * @bug 6859210 * @summary Test Schema Validator can parse xml when maxOccurs is large. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6859210 { boolean errorFound; --- old/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java 2016-07-18 00:52:26.561130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java 2016-07-18 00:52:26.436130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -40,6 +40,7 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -50,6 +51,7 @@ * @bug 6925531 * @summary Test Validator can validate SAXSource when SecurityManager is set or FEATURE_SECURE_PROCESSING is on. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug6925531Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java 2016-07-18 00:52:27.016130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java 2016-07-18 00:52:26.892130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -35,6 +35,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; @@ -47,6 +48,7 @@ * @bug 6946312 * @summary Test XML parser shall callback to ContentHandler when receiving characters data. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6946312Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; @@ -83,7 +85,8 @@ } } - public class MyContentHandler implements ContentHandler { + @Listeners({jaxp.library.BasePolicy.class}) +public class MyContentHandler implements ContentHandler { public void characters(char[] ch, int start, int length) { charEvent = true; System.out.println("Characters called: " + new String(ch, start, length)); --- old/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java 2016-07-18 00:52:27.451130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java 2016-07-18 00:52:27.327130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -40,6 +41,7 @@ * @bug 6954738 * @summary Test Validator can process a XML document containing an element with 8000 characters. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6954738_Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java 2016-07-18 00:52:27.902130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java 2016-07-18 00:52:27.781130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -38,12 +38,14 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6708840 * @summary Test Validator can process StAXSource. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR6708840Test { @Test --- old/test/javax/xml/jaxp/unittest/validation/CR6740048.java 2016-07-18 00:52:28.347130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/CR6740048.java 2016-07-18 00:52:28.226130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,6 +30,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.testng.Assert; import org.w3c.dom.Document; @@ -41,6 +42,7 @@ * @bug 6740048 * @summary Test DocumentBuilder can be reused when the DocumentBuilderFactory sets schema. */ +@Listeners({jaxp.library.FilePolicy.class}) public class CR6740048 { private static final String TAG_INFO = "containerInfo"; private static final String SCHEMA_LANGUAGE_URL = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; --- old/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java 2016-07-18 00:52:28.941130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java 2016-07-18 00:52:28.819130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/validation/Issue682Test.java 2016-07-18 00:52:29.397130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/Issue682Test.java 2016-07-18 00:52:29.277130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.testng.Assert; import org.xml.sax.InputSource; @@ -41,6 +42,7 @@ /* * @summary Test comination of fields in , for https://issues.apache.org/jira/browse/XERCESJ-682. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Issue682Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java 2016-07-18 00:52:29.842130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java 2016-07-18 00:52:29.708130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -40,6 +41,7 @@ /* * @summary Test maxOccurs validation. */ +@Listeners({jaxp.library.FilePolicy.class}) public class IssueTracker30 { boolean errorFound; --- old/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java 2016-07-18 00:52:30.338130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java 2016-07-18 00:52:30.205130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -38,6 +38,7 @@ import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -47,6 +48,7 @@ * @bug 6631318 * @summary Test creating schema from a DOM fragment with namespace. */ +@Listeners({jaxp.library.FilePolicy.class}) public class JaxpIssue43Test { @Test --- old/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java 2016-07-18 00:52:30.786130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java 2016-07-18 00:52:30.664130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -38,6 +38,7 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Node; @@ -45,6 +46,7 @@ * @bug 6684227 * @summary Test property current-element-node works. */ +@Listeners({jaxp.library.FilePolicy.class}) public class JaxpIssue49 { private Schema schema; --- old/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java 2016-07-18 00:52:31.222130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java 2016-07-18 00:52:31.097130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,11 +31,13 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test Validator shall report error for maxOccurs > 5000 when FEATURE_SECURE_PROCESSING is on, except the schema can be applied for constant-space algorithm. */ +@Listeners({jaxp.library.FilePolicy.class}) public class LargeMaxOccursTest { @Test --- old/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java 2016-07-18 00:52:31.657130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java 2016-07-18 00:52:31.532130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -40,6 +41,7 @@ /* * @summary Test Schema Validator can parse multiple or unbounded occurs. */ +@Listeners({jaxp.library.FilePolicy.class}) public class MultiOccursTest { boolean errorFound; --- old/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java 2016-07-18 00:52:32.127130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java 2016-07-18 00:52:32.004130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -40,6 +41,7 @@ /* * @summary Test Schema Validator can parse multiple or unbounded occurs. */ +@Listeners({jaxp.library.FilePolicy.class}) public class MultiOccursUnboundedTest { boolean errorFound; --- old/test/javax/xml/jaxp/unittest/validation/OccursTest.java 2016-07-18 00:52:32.562130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/OccursTest.java 2016-07-18 00:52:32.442130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -40,6 +41,7 @@ /* * @summary Test Schema Validator can parse multiple or unbounded occurs. */ +@Listeners({jaxp.library.FilePolicy.class}) public class OccursTest { boolean errorFound; --- old/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java 2016-07-18 00:52:32.999130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java 2016-07-18 00:52:32.874130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -40,6 +41,7 @@ /* * @summary Test Schema Validator can parse multiple or unbounded occurs. */ +@Listeners({jaxp.library.FilePolicy.class}) public class OccursUnboundedTest { boolean errorFound; --- old/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java 2016-07-18 00:52:33.442130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java 2016-07-18 00:52:33.321130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -40,6 +41,7 @@ /* * @summary Test Schema Validator can parse multiple or unbounded occurs. */ +@Listeners({jaxp.library.FilePolicy.class}) public class OccursWildcardTest { boolean errorFound; --- old/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java 2016-07-18 00:52:33.890130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java 2016-07-18 00:52:33.756130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -40,6 +41,7 @@ /* * @summary Test Schema Validator can parse multiple or unbounded occurs. */ +@Listeners({jaxp.library.FilePolicy.class}) public class OccursWildcardUnbounded { boolean errorFound; --- old/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java 2016-07-18 00:52:34.333130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java 2016-07-18 00:52:34.210130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -40,6 +41,7 @@ /* * @summary Test Schema Validator can parse multiple or unbounded occurs. */ +@Listeners({jaxp.library.FilePolicy.class}) public class ParticlesId005Test { boolean errorFound; --- old/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java 2016-07-18 00:52:34.788130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java 2016-07-18 00:52:34.669130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,11 +31,13 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test particlesIg004.xsd. */ +@Listeners({jaxp.library.FilePolicy.class}) public class ParticlesIg004Test { @Test --- old/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java 2016-07-18 00:52:35.222130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java 2016-07-18 00:52:35.104130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -40,6 +41,7 @@ /* * @summary Test Schema Validator can parse multiple or unbounded occurs. */ +@Listeners({jaxp.library.FilePolicy.class}) public class ParticlesQ013Test { boolean errorFound; --- old/test/javax/xml/jaxp/unittest/validation/SchemaTest.java 2016-07-18 00:52:35.978130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/SchemaTest.java 2016-07-18 00:52:35.529130271 -0700 @@ -28,12 +28,14 @@ import javax.xml.XMLConstants; import javax.xml.validation.SchemaFactory; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @summary Test Schema creation * @bug 8149915 */ +@Listeners({jaxp.library.FilePolicy.class}) public class SchemaTest { /* --- old/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java 2016-07-18 00:52:36.588130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java 2016-07-18 00:52:36.427130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -30,12 +30,14 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; /* * @summary Test groupA008.xsd. */ +@Listeners({jaxp.library.FilePolicy.class}) public class TCKGroupA008Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java 2016-07-18 00:52:37.215130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java 2016-07-18 00:52:37.043130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -39,12 +39,14 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; /* * @summary Test Validator.validate(Source, Result). */ +@Listeners({jaxp.library.FilePolicy.class}) public class ValidatorTest { @Test --- old/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java 2016-07-18 00:52:37.871130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java 2016-07-18 00:52:37.699130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java 2016-07-18 00:52:38.547130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java 2016-07-18 00:52:38.370130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java 2016-07-18 00:52:39.366130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java 2016-07-18 00:52:39.186130271 -0700 @@ -31,6 +31,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -38,6 +39,7 @@ * @bug 6943252 * @summary Test Schema doesn't allow to use value more than allowed by base type. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6943252Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java 2016-07-18 00:52:39.987130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java 2016-07-18 00:52:39.809130271 -0700 @@ -29,6 +29,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -36,6 +37,7 @@ * @bug 6963124 * @summary Test Schema doesn't allow maxOccurs > 1 for reference to all model group. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6963124Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java 2016-07-18 00:52:40.626130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java 2016-07-18 00:52:40.450130271 -0700 @@ -36,6 +36,7 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -48,6 +49,7 @@ * @bug 6963468 * @summary Test Validation allows element a is a union type and element b specifies a as its substitution group and b type is or is derived from one of the member types of the union. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6963468Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java 2016-07-18 00:52:41.213130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java 2016-07-18 00:52:41.092130271 -0700 @@ -29,6 +29,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -36,6 +37,7 @@ * @bug 6964720 * @summary Test Schema doesn't allow the inexpressible union of two attribute wildcards. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6964720Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java 2016-07-18 00:52:41.786130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java 2016-07-18 00:52:41.660130271 -0700 @@ -31,6 +31,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -38,6 +39,7 @@ * @bug 6967214 * @summary Test Schema doesn't allow unpaired parenthesises in regex. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6967214Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java 2016-07-18 00:52:42.202130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java 2016-07-18 00:52:42.083130271 -0700 @@ -29,6 +29,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -36,6 +37,7 @@ * @bug 6970890 * @summary Test Schema allows [-] in regex. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6970890Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java 2016-07-18 00:52:42.629130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java 2016-07-18 00:52:42.510130271 -0700 @@ -32,6 +32,7 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -39,6 +40,7 @@ * @bug 6971190 * @summary Test Validation accepts UTF lexical presentation. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6971190Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java 2016-07-18 00:52:43.071130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java 2016-07-18 00:52:42.948130271 -0700 @@ -34,6 +34,7 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; @@ -43,6 +44,7 @@ * @bug 6974551 * @summary Test Validation for SAXParser can expose whitespace facet for xs:anySimpleType. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6974551Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java 2016-07-18 00:52:43.530130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java 2016-07-18 00:52:43.406130271 -0700 @@ -31,6 +31,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -38,6 +39,7 @@ * @bug 6975265 * @summary Test Schema doesn't allow some Element Information Items contain other element information item. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6975265Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java 2016-07-18 00:52:43.995130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java 2016-07-18 00:52:43.863130271 -0700 @@ -30,12 +30,14 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6977201 * @summary Test Validator interprets regex "" correctly. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6977201Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java 2016-07-18 00:52:44.427130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java 2016-07-18 00:52:44.299130271 -0700 @@ -36,6 +36,7 @@ import javax.xml.validation.Validator; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; @@ -48,6 +49,7 @@ * @bug 6989956 * @summary Test Validation can process correctly that maxOccurs in Choice less than maxOccurs in Elements contained in the Choice. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug6989956Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java 2016-07-18 00:52:45.068130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java 2016-07-18 00:52:44.897130271 -0700 @@ -29,6 +29,7 @@ import javax.xml.validation.SchemaFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -36,6 +37,7 @@ * @bug 7014246 * @summary Test Schema doesn't allow maxInclusive of derived time type greater than the base. */ +@Listeners({jaxp.library.FilePolicy.class}) public class Bug7014246Test { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java 2016-07-18 00:52:45.692130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java 2016-07-18 00:52:45.513130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -28,6 +28,7 @@ import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -38,6 +39,7 @@ * @author Joe Wang (huizhe.wang@oracle.com) */ +@Listeners({jaxp.library.FilePolicy.class}) public class ParticleTest { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java 2016-07-18 00:52:46.294130271 -0700 +++ new/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java 2016-07-18 00:52:46.161130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -28,6 +28,7 @@ import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.SAXException; @@ -37,6 +38,7 @@ * "separator" and "other" characters are accepted by \w [#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}] * @author Joe Wang */ +@Listeners({jaxp.library.FilePolicy.class}) public class RegexWord { static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; --- old/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java 2016-07-18 00:52:46.740130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java 2016-07-18 00:52:46.614130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,6 +29,7 @@ import javax.xml.xpath.XPathFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -37,6 +38,7 @@ * @bug 4991857 * @summary XPath.evaluate(...) throws XPathExpressionException when context is null and expression refers to the context. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug4991857 { Document d = null; --- old/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java 2016-07-18 00:52:47.178130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java 2016-07-18 00:52:47.056130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,12 +29,14 @@ import javax.xml.xpath.XPathFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 4991939 * @summary XPath.evaluate(...) throws IllegalArgumentException if returnType is not one of the types defined in XPathConstants. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug4991939 { @Test --- old/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java 2016-07-18 00:52:47.610130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java 2016-07-18 00:52:47.493130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,6 +31,7 @@ import javax.xml.xpath.XPathFactoryConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; @@ -38,6 +39,7 @@ * @bug 4992788 * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if source is null. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug4992788 { private static String expression = "/widgets/widget[@name='a']/@quantity"; --- old/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java 2016-07-18 00:52:48.039130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java 2016-07-18 00:52:47.917130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -33,6 +33,7 @@ import javax.xml.xpath.XPathFactoryConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; @@ -40,6 +41,7 @@ * @bug 4992793 * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if expression is null. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug4992793 { --- old/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java 2016-07-18 00:52:48.498130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java 2016-07-18 00:52:48.375130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -32,6 +32,7 @@ import javax.xml.xpath.XPathFactoryConfigurationException; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; @@ -39,6 +40,7 @@ * @bug 4992805 * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if returnType is null. */ +@Listeners({jaxp.library.BasePolicy.class}) public class Bug4992805 { private static String expression = "/widgets/widget[@name='a']/@quantity"; --- old/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java 2016-07-18 00:52:48.922130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java 2016-07-18 00:52:48.805130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,12 +26,14 @@ import javax.xml.xpath.XPathFactory; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6354969 * @summary Test XPathFactory newInstance() with ContextClassLoader. */ +@Listeners({jaxp.library.BasePolicy.class}) public class ClassLoaderTest { @Test --- old/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java 2016-07-18 00:52:49.449130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java 2016-07-18 00:52:49.313130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 --- old/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java 2016-07-18 00:52:49.967130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java 2016-07-18 00:52:49.837130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -23,6 +23,7 @@ package xpath; +import java.io.FilePermission; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; @@ -42,6 +43,8 @@ import javax.xml.xpath.XPathFunctionException; import javax.xml.xpath.XPathFunctionResolver; +import jaxp.library.JAXPTestUtilities; + import org.testng.Assert; import org.testng.annotations.Test; import org.w3c.dom.Document; @@ -50,19 +53,19 @@ /* * @summary Test when FEATURE_SECURE_PROCESSING is true, calling an external function will cause XPathFunctionException. */ +@Test(singleThreaded = true) public class SecureProcessingTest { - static boolean _isSecureMode = false; - static { - if (System.getSecurityManager() != null) { - _isSecureMode = true; - System.out.println("Security Manager is present"); - } else { - System.out.println("Security Manager is NOT present"); - } + public void runWithSecurityManager() throws Exception { + JAXPTestUtilities.tryRunWithPolicyManager(() -> testSecureProcessing(), + new FilePermission(System.getProperty("test.src") + "/-", "read")); + } + + public void runWithoutSecurityManager() throws Exception { + testSecureProcessing(); } - @Test - public final void testSecureProcessing() { + private final void testSecureProcessing() { + boolean _isSecureMode = System.getSecurityManager() != null; final String XPATH_EXPRESSION = "ext:helloWorld()"; @@ -150,7 +153,7 @@ } } - public class MyXPathFunctionResolver implements XPathFunctionResolver { + private class MyXPathFunctionResolver implements XPathFunctionResolver { public XPathFunction resolveFunction(QName functionName, int arity) { @@ -159,7 +162,7 @@ } } - public class MyXPathFunction implements XPathFunction { + private class MyXPathFunction implements XPathFunction { public Object evaluate(List list) throws XPathFunctionException { @@ -167,7 +170,7 @@ } } - public class MyNamespaceContext implements NamespaceContext { + private class MyNamespaceContext implements NamespaceContext { public String getNamespaceURI(String prefix) { if (prefix == null) { --- old/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java 2016-07-18 00:52:50.518130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java 2016-07-18 00:52:50.378130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -32,6 +32,7 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -41,6 +42,7 @@ * @summary Test for the project XPath: support any type. This test covers the new * evaluateExpression methods of XPath, as well as XPathNodes and XPathEvaluationResult. */ +@Listeners({jaxp.library.BasePolicy.class}) public class XPathAnyTypeTest extends XPathTestBase { /* Test for resolveFunction(QName functionName,int arity); evaluate throws --- old/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java 2016-07-18 00:52:50.969130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java 2016-07-18 00:52:50.834130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -34,6 +34,7 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -43,6 +44,7 @@ * @summary Test for the project XPath: support any type. This test covers the new * evaluateExpression methods of XPathExpression. */ +@Listeners({jaxp.library.BasePolicy.class}) public class XPathExpAnyTypeTest extends XPathTestBase { /* --- old/test/javax/xml/jaxp/unittest/xpath/XPathTest.java 2016-07-18 00:52:51.477130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/XPathTest.java 2016-07-18 00:52:51.322130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,12 +27,14 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathFactory; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; /* * @bug 6376058 * @summary Test XPath.getNamespaceContext() is supported. */ +@Listeners({jaxp.library.BasePolicy.class}) public class XPathTest { @Test --- old/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java 2016-07-18 00:52:51.932130271 -0700 +++ new/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java 2016-07-18 00:52:51.810130271 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 --- /dev/null 2016-07-18 02:17:27.392000000 -0700 +++ new/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java 2016-07-18 00:52:52.279130271 -0700 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016, 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. + */ +package jaxp.library; + +import org.testng.ITestContext; +import org.testng.ITestListener; +import org.testng.ITestResult; + +/** + * This policy includes default permissions. + * It should be used as one listener: either TestListener or MethodListener. + */ +public class BasePolicy implements ITestListener { + + @Override + public void onFinish(ITestContext arg0) { + try { + JAXPPolicyManager.teardownPolicyManager(); + } catch (Exception e) { + throw new RuntimeException("Failed to teardonw the policy manager", e); + } + } + + @Override + public void onStart(ITestContext arg0) { + JAXPPolicyManager.getJAXPPolicyManager(true); + } + + @Override + public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) { + } + + @Override + public void onTestFailure(ITestResult arg0) { + } + + @Override + public void onTestSkipped(ITestResult arg0) { + } + + @Override + public void onTestStart(ITestResult arg0) { + } + + @Override + public void onTestSuccess(ITestResult arg0) { + } +} --- /dev/null 2016-07-18 02:17:27.392000000 -0700 +++ new/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java 2016-07-18 00:52:52.743130271 -0700 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016, 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. + */ +package jaxp.library; + +import java.io.FilePermission; + +import org.testng.ITestContext; + +/** + * This policy can access local XML files. + */ +public class FilePolicy extends BasePolicy { + + @Override + public void onStart(ITestContext arg0) { + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); + policyManager.addPermission(new FilePermission(System.getProperty("user.dir") + "/-", "read, write, delete")); + policyManager.addPermission(new FilePermission(System.getProperty("test.src") + "/-", "read")); + policyManager.addPermission(new FilePermission(System.getProperty("user.dir"), "read")); + } +} \ No newline at end of file --- /dev/null 2016-07-18 02:17:27.392000000 -0700 +++ new/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java 2016-07-18 00:52:53.181130271 -0700 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016, 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. + */ +package jaxp.library; + +import org.testng.ITestContext; + +/** + * This policy can access internal jaxp packages. + */ +public class InternalAPIPolicy extends BasePolicy { + + @Override + public void onStart(ITestContext arg0) { + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); + policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.xerces.internal.jaxp")); + policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.bcel.internal.classfile")); + policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.bcel.internal.generic")); + policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.xalan.internal.xsltc.trax")); + } +} \ No newline at end of file --- /dev/null 2016-07-18 02:17:27.392000000 -0700 +++ new/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java 2016-07-18 00:52:53.607130271 -0700 @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2015, 2016, 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. + */ +package jaxp.library; + + +import java.lang.reflect.ReflectPermission; +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.security.Policy; +import java.security.ProtectionDomain; +import java.security.SecurityPermission; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.PropertyPermission; +import java.util.StringJoiner; + + +/* + * This is a base class that every test class must extend if it needs to be run + * with security mode. + */ +public class JAXPPolicyManager { + /* + * Backing up policy. + */ + private Policy policyBackup; + + /* + * Backing up security manager. + */ + private SecurityManager smBackup; + + /* + * Current policy. + */ + private TestPolicy policy = new TestPolicy(); + + /* + * JAXPPolicyManager singleton. + */ + private static JAXPPolicyManager policyManager = null; + + /* + * Install a SecurityManager along with a default Policy to allow testNG to + * run when there is a security manager. + */ + private JAXPPolicyManager() { + // Backing up policy and security manager for restore + policyBackup = Policy.getPolicy(); + smBackup = System.getSecurityManager(); + + // Set customized policy + setDefaultPermissions(); + Policy.setPolicy(policy); + System.setSecurityManager(new SecurityManager()); + } + + static synchronized JAXPPolicyManager getJAXPPolicyManager(boolean createIfNone) { + if (policyManager == null & createIfNone) + policyManager = new JAXPPolicyManager(); + return policyManager; + } + + private void teardown() throws Exception { + System.setSecurityManager(smBackup); + Policy.setPolicy(policyBackup); + } + + /* + * Restore the original Policy and SecurityManager. + */ + static synchronized void teardownPolicyManager() throws Exception { + if (policyManager != null) { + policyManager.teardown(); + policyManager = null; + } + } + + /* + * Set default permissions, sub-class of JAXPBaseTest should override this + * method. + */ + private void setDefaultPermissions() { + addPermission(new SecurityPermission("getPolicy")); + addPermission(new SecurityPermission("setPolicy")); + addPermission(new RuntimePermission("getClassLoader")); + addPermission(new RuntimePermission("createClassLoader")); + addPermission(new RuntimePermission("setSecurityManager")); + addPermission(new RuntimePermission("createSecurityManager")); + addPermission(new RuntimePermission("modifyThread")); + addPermission(new PropertyPermission("*", "read, write")); + addPermission(new ReflectPermission("suppressAccessChecks")); + addPermission(new RuntimePermission("setIO")); + addPermission(new RuntimePermission("setContextClassLoader")); + addPermission(new RuntimePermission("accessDeclaredMembers")); + } + + /* + * Add permission to the TestPolicy. + * + * @param permission to be added. + */ + void addPermission(Permission p) { + policy.addPermission(p); + } + + /* + * Add a temporary permission in current thread context. This won't impact + * global policy and doesn't support permission combination. + * + * @param permission + * to add. + * @return index of the added permission. + */ + int addTmpPermission(Permission p) { + return policy.addTmpPermission(p); + } + + /* + * Remove a temporary permission from current thread context. + * + * @param index to remove. + * + * @throws RuntimeException if no temporary permission list in current + * thread context or no permission correlated to the index. + */ + void removeTmpPermission(int index) { + policy.removeTmpPermission(index); + } + + +} + +/* + * Simple Policy class that supports the required Permissions to validate the + * JAXP concrete classes. + */ +class TestPolicy extends Policy { + private final PermissionCollection permissions = new Permissions(); + + private ThreadLocal> transientPermissions = new ThreadLocal<>(); + + private static Policy defaultPolicy = Policy.getPolicy(); + + /* + * Add permission to this policy. + * + * @param permission to be added. + */ + void addPermission(Permission p) { + permissions.add(p); + } + + /* + * Set all permissions. Caution: this should not called carefully unless + * it's really needed. + * + * private void setAllPermissions() { permissions.add(new AllPermission()); + * } + */ + + /* + * Overloaded methods from the Policy class. + */ + @Override + public String toString() { + StringJoiner sj = new StringJoiner("\n", "policy: ", ""); + Enumeration perms = permissions.elements(); + while (perms.hasMoreElements()) { + sj.add(perms.nextElement().toString()); + } + return sj.toString(); + + } + + @Override + public PermissionCollection getPermissions(ProtectionDomain domain) { + return permissions; + } + + @Override + public PermissionCollection getPermissions(CodeSource codesource) { + return permissions; + } + + @Override + public boolean implies(ProtectionDomain domain, Permission perm) { + if (defaultPolicy.implies(domain, perm)) + return true; + + if (permissions.implies(perm)) + return true; + else + return tmpImplies(perm); + } + + /* + * Add a temporary permission in current thread context. This won't impact + * global policy and doesn't support permission combination. + * + * @param permission to add. + * @return index of the added permission. + */ + int addTmpPermission(Permission p) { + List tmpPermissions = transientPermissions.get(); + if (tmpPermissions == null) + tmpPermissions = new ArrayList<>(); + + tmpPermissions.add(p); + transientPermissions.set(tmpPermissions); + return tmpPermissions.size() - 1; + } + + /* + * Remove a temporary permission from current thread context. + * + * @param index to remove. + * + * @throws RuntimeException if no temporary permission list in current + * thread context or no permission correlated to the index. + */ + void removeTmpPermission(int index) { + try { + List tmpPermissions = transientPermissions.get(); + tmpPermissions.remove(index); + } catch (NullPointerException | IndexOutOfBoundsException e) { + throw new RuntimeException("Tried to delete a non-existent temporary permission", e); + } + } + + /* + * Checks to see if the specified permission is implied by temporary + * permission list in current thread context. + * + * @param permission the Permission object to compare. + * + * @return true if "permission" is implied by any permission in the + * temporary permission list, false if not. + */ + private boolean tmpImplies(Permission perm) { + List tmpPermissions = transientPermissions.get(); + if (tmpPermissions != null) { + for (Permission p : tmpPermissions) { + if (p.implies(perm)) + return true; + } + } + return false; + } +} --- /dev/null 2016-07-18 02:17:27.392000000 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java 2016-07-18 00:52:54.022130271 -0700 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2014, 2016, 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 8003147 + * @summary Test port fix for BCEL bug 39695. + */ + +package parsers; + +import java.io.FileOutputStream; +import java.io.FilePermission; + +import jaxp.library.JAXPTestUtilities; + +import org.testng.Assert; +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; + +import com.sun.org.apache.bcel.internal.classfile.ClassParser; +import com.sun.org.apache.bcel.internal.classfile.ConstantClass; +import com.sun.org.apache.bcel.internal.classfile.ConstantPool; +import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8; +import com.sun.org.apache.bcel.internal.classfile.JavaClass; +import com.sun.org.apache.bcel.internal.classfile.Method; +import com.sun.org.apache.bcel.internal.generic.ClassGen; +import com.sun.org.apache.bcel.internal.generic.MethodGen; + +@Listeners({ jaxp.library.FilePolicy.class, jaxp.library.InternalAPIPolicy.class }) +public class Bug8003147Test { + + @Test + public void test() throws Exception { + // Note: com.sun.org.apache.bcel.internal.classfile.JavaClass doesn't + // support InvokeDynamic, so can't use lambda, also can't use string1 + + // string2, because javac will generate a dynamic call where invoking + // string1.concat(string2), so create a separate Bug8003147TestClass + JAXPTestUtilities.tryRunWithTmpPermission(() -> { + String classfile = System.getProperty("test.classes") + "/parsers/Bug8003147TestClass.class"; + JavaClass jc = new ClassParser(classfile).parse(); + + // rename class + ConstantPool cp = jc.getConstantPool(); + int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex(); + cp.setConstant(cpIndex, new ConstantUtf8("parsers/Bug8003147TestClassPrime")); + ClassGen gen = new ClassGen(jc); + Method[] methods = jc.getMethods(); + int index; + for (index = 0; index < methods.length; index++) { + if (methods[index].getName().equals("doSomething")) { + break; + } + } + Method m = methods[index]; + MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool()); + gen.replaceMethod(m, mg.getMethod()); + String path = classfile.replace("Bug8003147TestClass", "Bug8003147TestClassPrime"); + gen.getJavaClass().dump(new FileOutputStream(path)); + + try { + Class.forName("parsers.Bug8003147TestClassPrime"); + } catch (ClassFormatError cfe) { + cfe.printStackTrace(); + Assert.fail("modified version of class does not pass verification"); + } + }, new FilePermission(System.getProperty("test.classes") + "/-", "read, write")); + } +} --- /dev/null 2016-07-18 02:17:27.392000000 -0700 +++ new/test/javax/xml/jaxp/unittest/parsers/Bug8003147TestClass.java 2016-07-18 00:52:54.430130271 -0700 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016, 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. + */ + +package parsers; + +import java.util.ArrayList; + +/* + * Class for Bug8003147Test, includes a method, which has a generic argument + */ +public class Bug8003147TestClass { + public void doSomething(double d, ArrayList list) { + } +} --- /dev/null 2016-07-18 02:17:27.392000000 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/Bug6551616.java 2016-07-18 00:52:54.847130271 -0700 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2014, 2016, 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 6551616 + * @summary Test SAX2StAXEventWriter. + */ + +package transform; + +import java.io.InputStream; +import java.io.StringBufferInputStream; + +import javax.xml.stream.XMLEventWriter; +import javax.xml.stream.XMLOutputFactory; + +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; + +import com.sun.org.apache.xalan.internal.xsltc.trax.SAX2StAXEventWriter; + +@Listeners({jaxp.library.InternalAPIPolicy.class}) +public class Bug6551616 { + String _cache = ""; + + + @Test + public void test() throws Exception { + final String XML = "" + "" + "

Test

"; + + javax.xml.parsers.SAXParserFactory saxFactory = javax.xml.parsers.SAXParserFactory.newInstance(); + + javax.xml.parsers.SAXParser parser = saxFactory.newSAXParser(); + + XMLOutputFactory outFactory = XMLOutputFactory.newInstance(); + XMLEventWriter writer = outFactory.createXMLEventWriter(System.out); + + SAX2StAXEventWriter handler = new SAX2StAXEventWriter(writer); + + InputStream is = new StringBufferInputStream(XML); + + parser.parse(is, handler); + + // if it doesn't blow up, it succeeded. + } +} --- /dev/null 2016-07-18 02:17:27.392000000 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/CLITest.java 2016-07-18 00:52:55.254130271 -0700 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014, 2016, 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 + * @summary Test internal transform CLI. + */ + +package transform; + +import org.testng.Assert; +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; + +@Listeners({jaxp.library.FilePolicy.class}) +public class CLITest { + + @Test + public void testCLI() { + try { + String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(), "-IN", + getClass().getResource("tigertest-in.xml").toString(), }; + ProcessXSLT.main(args); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + } +} --- /dev/null 2016-07-18 02:17:27.392000000 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/ProcessXSLT.java 2016-07-18 00:52:55.656130271 -0700 @@ -0,0 +1,916 @@ +/* + * reserved comment block + * DO NOT REMOVE OR ALTER! + */ +/* + * Copyright 1999-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * $Id: Process.java,v 1.2.4.2 2005/09/15 18:21:57 jeffsuttor Exp $ + */ + +// This file is a copied and modified version of +// com/sun/org/apache/xalan/internal/xslt/Process.java +// which has been modified to only use public exported APIs. +// The only adherence is with +// com.sun.org.apache.xml.internal.utils.DefaultErrorHandler +// which we try to instantiate using reflection, as that class +// can do a better job at reporting error location. +// We however don't have a hard dependency on it. We will use +// our own ErrorHandler if the default one is not accessible. +// + +package transform; + +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.io.StringReader; +import java.util.Properties; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; +import javax.xml.transform.URIResolver; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.sax.SAXSource; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.sax.TransformerHandler; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import javax.xml.transform.ErrorListener; +import javax.xml.transform.SourceLocator; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import org.xml.sax.ContentHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLReaderFactory; + +/** + * The main() method handles the Xalan command-line interface. + */ +public class ProcessXSLT +{ + + /** + * Prints argument options. + * + */ + protected static void printArgOptions() { + System.out.println("xslproc options: "); + System.out.println("\n\t\t\t" + "-Common Options-" + "\n"); + System.out.println(" [-XSLTC (use XSLTC for transformation)]"); //" [-XSLTC (use XSLTC for transformation)] + System.out.println(" [-IN inputXMLURL]"); //" [-IN inputXMLURL]"); + System.out.println(" [-XSL XSLTransformationURL]"); //" [-XSL XSLTransformationURL]"); + System.out.println(" [-OUT outputFileName]"); //" [-OUT outputFileName]"); + + System.out.println(" [-E (Do not expand entity refs)]"); //" [-V (Version info)]"); + + System.out.println(" [-EDUMP {optional filename} (Do stackdump on error.)]"); //" [-EDUMP {optional filename} (Do stackdump on error.)]"); + System.out.println(" [-XML (Use XML formatter and add XML header.)]"); //" [-XML (Use XML formatter and add XML header.)]"); + System.out.println(" [-TEXT (Use simple Text formatter.)]"); //" [-TEXT (Use simple Text formatter.)]"); + System.out.println(" [-HTML (Use HTML formatter.)]"); //" [-HTML (Use HTML formatter.)]"); + System.out.println( " [-PARAM name expression (Set a stylesheet parameter)]"); //" [-PARAM name expression (Set a stylesheet parameter)]"); + + System.out.println(" [-MEDIA mediaType (use media attribute to find stylesheet associated with a document.)]"); + System.out.println(" [-FLAVOR flavorName (Explicitly use s2s=SAX or d2d=DOM to do transform.)] "); + System.out.println(" [-DIAG (Print overall milliseconds transform took.)]"); + System.out.println(" [-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]"); //" [-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]"); + System.out.println(" [-ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities)]"); //" [-ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities)]"); + waitForReturnKey(); + System.out.println(" [-CONTENTHANDLER full class name (ContentHandler to be used to serialize output)]"); //" [-CONTENTHANDLER full class name (ContentHandler to be used to serialize output)]"); + System.out.println(" [-SECURE (set the secure processing feature to true.)]"); //" [-SECURE (set the secure processing feature to true)]"); + + + System.out.println("\n\t\t\t"+ "-Options for XSLTC-" + "\n"); + System.out.println(" [-XO [transletName] (assign the name to the generated translet)]"); + waitForReturnKey(); + System.out.println(" [-XD destinationDirectory (specify a destination directory for translet)]"); + System.out.println(" [-XJ jarfile (packages translet classes into a jar file of name )]"); + System.out.println(" [-XP package (specifies a package name prefix for all generated translet classes)]"); + System.out.println(" [-XN (enables template inlining)]"); + System.out.println(" [-XX (turns on additional debugging message output)]"); + System.out.println(" [-XT (use translet to transform if possible)]"); + } + + /** + * Command line interface to transform an XML document according to + * the instructions found in an XSL stylesheet. + *

The Process class provides basic functionality for + * performing transformations from the command line. To see a + * list of arguments supported, call with zero arguments.

+ *

To set stylesheet parameters from the command line, use + * -PARAM name expression. If you want to set the + * parameter to a string value, simply pass the string value + * as-is, and it will be interpreted as a string. (Note: if + * the value has spaces in it, you may need to quote it depending + * on your shell environment).

+ * + * @param argv Input parameters from command line + */ + public static void main(String argv[]) { + + // Runtime.getRuntime().traceMethodCalls(false); // turns Java tracing off + boolean doStackDumpOnError = false; + boolean doDiag = false; + boolean setQuietMode = false; + String msg = null; + boolean isSecureProcessing = false; + + // Runtime.getRuntime().traceMethodCalls(false); + // Runtime.getRuntime().traceInstructions(false); + /** + * The default diagnostic writer... + */ + java.io.PrintWriter diagnosticsWriter = new PrintWriter(System.err, true); + java.io.PrintWriter dumpWriter = diagnosticsWriter; + String flavor = "s2s"; + + if (argv.length < 1) { + printArgOptions(); + } else { + // J2SE does not support Xalan interpretive + // false -> true + boolean useXSLTC = true; + for (int i = 0; i < argv.length; i++) { + if ("-XSLTC".equalsIgnoreCase(argv[i])) { + useXSLTC = true; + } + } + + TransformerFactory tfactory; + if (useXSLTC) { + String key = "javax.xml.transform.TransformerFactory"; + String value = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"; + Properties props = System.getProperties(); + props.put(key, value); + System.setProperties(props); + } + + try { + tfactory = TransformerFactory.newInstance(); + tfactory.setErrorListener(createDefaultErrorListener()); + } catch (TransformerFactoryConfigurationError pfe) { + pfe.printStackTrace(dumpWriter); + // "XSL Process was not successful."); + msg = "XSL Process was not successful."; + diagnosticsWriter.println(msg); + + tfactory = null; // shut up compiler + + doExit(msg); + } + + boolean formatOutput = false; + boolean useSourceLocation = false; + String inFileName = null; + String outFileName = null; + String dumpFileName = null; + String xslFileName = null; + String treedumpFileName = null; + String outputType = null; + String media = null; + List params = new ArrayList<>(); + boolean quietConflictWarnings = false; + URIResolver uriResolver = null; + EntityResolver entityResolver = null; + ContentHandler contentHandler = null; + int recursionLimit = -1; + + for (int i = 0; i < argv.length; i++) { + if ("-XSLTC".equalsIgnoreCase(argv[i])) { + // The -XSLTC option has been processed. + } // J2SE does not support Xalan interpretive + else if ("-INDENT".equalsIgnoreCase(argv[i])) { + int indentAmount; + + if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-')) { + indentAmount = Integer.parseInt(argv[++i]); + } else { + indentAmount = 0; + } + + } else if ("-IN".equalsIgnoreCase(argv[i])) { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + inFileName = argv[++i]; + } else { + System.err.println("Missing argument for -IN"); + } + } else if ("-MEDIA".equalsIgnoreCase(argv[i])) { + if (i + 1 < argv.length) { + media = argv[++i]; + } else { + System.err.println("Missing argument for -MEDIA"); //"Missing argument for); + } + } else if ("-OUT".equalsIgnoreCase(argv[i])) { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + outFileName = argv[++i]; + } else { + System.err.println("Missing argument for -OUT"); //"Missing argument for); + } + } else if ("-XSL".equalsIgnoreCase(argv[i])) { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + xslFileName = argv[++i]; + } else { + System.err.println("Missing argument for -XSL"); //"Missing argument for); + } + } else if ("-FLAVOR".equalsIgnoreCase(argv[i])) { + if (i + 1 < argv.length) { + flavor = argv[++i]; + } else { + System.err.println("Missing argument for -FLAVOR"); //"Missing argument for); + } + } else if ("-PARAM".equalsIgnoreCase(argv[i])) { + if (i + 2 < argv.length) { + String name = argv[++i]; + + params.add(name); + + String expression = argv[++i]; + + params.add(expression); + } else { + System.err.println("Missing argument for -PARAM"); //"Missing argument for); + } + } else if ("-E".equalsIgnoreCase(argv[i])) { + + } else if ("-V".equalsIgnoreCase(argv[i])) { + diagnosticsWriter.println(">>>>>>> Java Version " + + System.getProperty("java.version") + ", " + + /* xmlProcessorLiaison.getParserDescription()+ */ "<<<<<<<"); + } // J2SE does not support Xalan interpretive + /* + else if ("-QC".equalsIgnoreCase(argv[i])) + { + if (!useXSLTC) + quietConflictWarnings = true; + else + printInvalidXSLTCOption("-QC"); + } + */ else if ("-Q".equalsIgnoreCase(argv[i])) { + setQuietMode = true; + } else if ("-DIAG".equalsIgnoreCase(argv[i])) { + doDiag = true; + } else if ("-XML".equalsIgnoreCase(argv[i])) { + outputType = "xml"; + } else if ("-TEXT".equalsIgnoreCase(argv[i])) { + outputType = "text"; + } else if ("-HTML".equalsIgnoreCase(argv[i])) { + outputType = "html"; + } else if ("-EDUMP".equalsIgnoreCase(argv[i])) { + doStackDumpOnError = true; + + if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-')) { + dumpFileName = argv[++i]; + } + } else if ("-URIRESOLVER".equalsIgnoreCase(argv[i])) { + if (i + 1 < argv.length) { + try { + Class uriResolverClass = Class.forName(argv[++i]); + Constructor ctor = uriResolverClass.getConstructor(); + ctor.setAccessible(true); + uriResolver = (URIResolver) ctor.newInstance(); + + tfactory.setURIResolver(uriResolver); + } catch (Throwable cnfe) { + msg = "Class not found for option -URIResolver"; + System.err.println(msg); + doExit(msg); + } + } else { + msg = "Missing argument for -URIResolver"; + System.err.println(msg); //"Missing argument for); + doExit(msg); + } + } else if ("-ENTITYRESOLVER".equalsIgnoreCase(argv[i])) { + if (i + 1 < argv.length) { + try { + Class entityResolverClass = Class.forName(argv[++i]); + Constructor ctor = entityResolverClass.getConstructor(); + ctor.setAccessible(true); + entityResolver = (EntityResolver) ctor.newInstance(); + } catch (Throwable cnfe) { + msg = "Class not found for option -EntityResolver"; + System.err.println(msg); + doExit(msg); + } + } else { + // "Missing argument for); + msg = "Missing argument for -EntityResolver"; + System.err.println(msg); + doExit(msg); + } + } else if ("-CONTENTHANDLER".equalsIgnoreCase(argv[i])) { + if (i + 1 < argv.length) { + try { + Class contentHandlerClass = Class.forName(argv[++i]); + Constructor ctor = contentHandlerClass.getConstructor(); + ctor.setAccessible(true); + contentHandler = (ContentHandler) ctor.newInstance(); + } catch (Throwable cnfe) { + msg = "Class not found for option -ContentHandler"; + System.err.println(msg); + doExit(msg); + } + } else { + // "Missing argument for); + msg = "Missing argument for -ContentHandler"; + System.err.println(msg); + doExit(msg); + } + } else if ("-XO".equalsIgnoreCase(argv[i])) { + if (useXSLTC) { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + tfactory.setAttribute("generate-translet", "true"); + tfactory.setAttribute("translet-name", argv[++i]); + } else { + tfactory.setAttribute("generate-translet", "true"); + } + } else { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + i++; + } + printInvalidXalanOption("-XO"); + } + } // Specify the destination directory for the translet classes. + else if ("-XD".equalsIgnoreCase(argv[i])) { + if (useXSLTC) { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + tfactory.setAttribute("destination-directory", argv[++i]); + } else { + System.err.println("Missing argument for -XD"); //"Missing argument for); + } + } else { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + i++; + } + + printInvalidXalanOption("-XD"); + } + } // Specify the jar file name which the translet classes are packaged into. + else if ("-XJ".equalsIgnoreCase(argv[i])) { + if (useXSLTC) { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + tfactory.setAttribute("generate-translet", "true"); + tfactory.setAttribute("jar-name", argv[++i]); + } else { + System.err.println("Missing argument for -XJ"); //"Missing argument for); + } + } else { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + i++; + } + + printInvalidXalanOption("-XJ"); + } + + } // Specify the package name prefix for the generated translet classes. + else if ("-XP".equalsIgnoreCase(argv[i])) { + if (useXSLTC) { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + tfactory.setAttribute("package-name", argv[++i]); + } else { + System.err.println("Missing argument for -XP"); //"Missing argument for); + } + } else { + if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { + i++; + } + + printInvalidXalanOption("-XP"); + } + + } // Enable template inlining. + else if ("-XN".equalsIgnoreCase(argv[i])) { + if (useXSLTC) { + tfactory.setAttribute("enable-inlining", "true"); + } else { + printInvalidXalanOption("-XN"); + } + } // Turns on additional debugging message output + else if ("-XX".equalsIgnoreCase(argv[i])) { + if (useXSLTC) { + tfactory.setAttribute("debug", "true"); + } else { + printInvalidXalanOption("-XX"); + } + } // Create the Transformer from the translet if the translet class is newer + // than the stylesheet. + else if ("-XT".equalsIgnoreCase(argv[i])) { + if (useXSLTC) { + tfactory.setAttribute("auto-translet", "true"); + } else { + printInvalidXalanOption("-XT"); + } + } else if ("-SECURE".equalsIgnoreCase(argv[i])) { + isSecureProcessing = true; + try { + tfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + } catch (TransformerConfigurationException e) { + } + } else { + System.err.println("Invalid argument: " + argv[i]); //"Invalid argument:); + } + } + + // Print usage instructions if no xml and xsl file is specified in the command line + if (inFileName == null && xslFileName == null) { + msg = "Error: No stylesheet or input xml is specified. Run this command without any option for usage instructions."; + System.err.println(msg); + doExit(msg); + } + + // Note that there are usage cases for calling us without a -IN arg + // The main XSL transformation occurs here! + try { + long start = System.currentTimeMillis(); + + if (null != dumpFileName) { + dumpWriter = new PrintWriter(new FileWriter(dumpFileName)); + } + + Templates stylesheet = null; + + if (null != xslFileName) { + if (flavor.equals("d2d")) { + + // Parse in the xml data into a DOM + DocumentBuilderFactory dfactory + = DocumentBuilderFactory.newInstance(); + + dfactory.setNamespaceAware(true); + + if (isSecureProcessing) { + try { + dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + } catch (ParserConfigurationException pce) { + } + } + + DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); + Node xslDOM = docBuilder.parse(new InputSource(xslFileName)); + + stylesheet = tfactory.newTemplates(new DOMSource(xslDOM, + xslFileName)); + } else { + // System.out.println("Calling newTemplates: "+xslFileName); + stylesheet = tfactory.newTemplates(new StreamSource(xslFileName)); + // System.out.println("Done calling newTemplates: "+xslFileName); + } + } + + PrintWriter resultWriter; + StreamResult strResult; + + if (null != outFileName) { + strResult = new StreamResult(new FileOutputStream(outFileName)); + // One possible improvement might be to ensure this is + // a valid URI before setting the systemId, but that + // might have subtle changes that pre-existing users + // might notice; we can think about that later -sc r1.46 + strResult.setSystemId(outFileName); + } else { + strResult = new StreamResult(System.out); + // We used to default to incremental mode in this case. + // We've since decided that since the -INCREMENTAL switch is + // available, that default is probably not necessary nor + // necessarily a good idea. + } + + SAXTransformerFactory stf = (SAXTransformerFactory) tfactory; + + // Did they pass in a stylesheet, or should we get it from the + // document? + if (null == stylesheet) { + Source source + = stf.getAssociatedStylesheet(new StreamSource(inFileName), media, + null, null); + + if (null != source) { + stylesheet = tfactory.newTemplates(source); + } else { + if (null != media) { + throw new TransformerException("No stylesheet found in: " + + inFileName + ", media=" + media); //"No stylesheet found in: " + } // + inFileName + ", media=" + // + media); + else { + throw new TransformerException("No xml-stylesheet PI found in: " + inFileName); //"No xml-stylesheet PI found in: " + } //+ inFileName); + } + } + + if (null != stylesheet) { + Transformer transformer = flavor.equals("th") ? null : stylesheet.newTransformer(); + transformer.setErrorListener(createDefaultErrorListener()); + + // Override the output format? + if (null != outputType) { + transformer.setOutputProperty(OutputKeys.METHOD, outputType); + } + + int nParams = params.size(); + + for (int i = 0; i < nParams; i += 2) { + transformer.setParameter((String) params.get(i), + (String) params.get(i + 1)); + } + + if (uriResolver != null) { + transformer.setURIResolver(uriResolver); + } + + if (null != inFileName) { + if (flavor.equals("d2d")) { + + // Parse in the xml data into a DOM + DocumentBuilderFactory dfactory + = DocumentBuilderFactory.newInstance(); + + dfactory.setCoalescing(true); + dfactory.setNamespaceAware(true); + + if (isSecureProcessing) { + try { + dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + } catch (ParserConfigurationException pce) { + } + } + + DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); + + if (entityResolver != null) { + docBuilder.setEntityResolver(entityResolver); + } + + Node xmlDoc = docBuilder.parse(new InputSource(inFileName)); + Document doc = docBuilder.newDocument(); + org.w3c.dom.DocumentFragment outNode + = doc.createDocumentFragment(); + + transformer.transform(new DOMSource(xmlDoc, inFileName), + new DOMResult(outNode)); + + // Now serialize output to disk with identity transformer + Transformer serializer = stf.newTransformer(); + serializer.setErrorListener(createDefaultErrorListener()); + + Properties serializationProps + = stylesheet.getOutputProperties(); + + serializer.setOutputProperties(serializationProps); + + if (contentHandler != null) { + SAXResult result = new SAXResult(contentHandler); + + serializer.transform(new DOMSource(outNode), result); + } else { + serializer.transform(new DOMSource(outNode), strResult); + } + } else if (flavor.equals("th")) { + for (int i = 0; i < 1; i++) // Loop for diagnosing bugs with inconsistent behavior + { + // System.out.println("Testing the TransformerHandler..."); + + XMLReader reader = null; + + // Use JAXP1.1 ( if possible ) + try { + javax.xml.parsers.SAXParserFactory factory + = javax.xml.parsers.SAXParserFactory.newInstance(); + + factory.setNamespaceAware(true); + + if (isSecureProcessing) { + try { + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + } catch (org.xml.sax.SAXException se) { + } + } + + javax.xml.parsers.SAXParser jaxpParser + = factory.newSAXParser(); + + reader = jaxpParser.getXMLReader(); + } catch (javax.xml.parsers.ParserConfigurationException ex) { + throw new org.xml.sax.SAXException(ex); + } catch (javax.xml.parsers.FactoryConfigurationError ex1) { + throw new org.xml.sax.SAXException(ex1.toString()); + } catch (NoSuchMethodError ex2) { + } catch (AbstractMethodError ame) { + } + + if (null == reader) { + reader = XMLReaderFactory.createXMLReader(); + } + + TransformerHandler th = stf.newTransformerHandler(stylesheet); + + reader.setContentHandler(th); + reader.setDTDHandler(th); + + if (th instanceof org.xml.sax.ErrorHandler) { + reader.setErrorHandler((org.xml.sax.ErrorHandler) th); + } + + try { + reader.setProperty( + "http://xml.org/sax/properties/lexical-handler", th); + } catch (org.xml.sax.SAXNotRecognizedException e) { + } catch (org.xml.sax.SAXNotSupportedException e) { + } + try { + reader.setFeature("http://xml.org/sax/features/namespace-prefixes", + true); + } catch (org.xml.sax.SAXException se) { + } + + th.setResult(strResult); + + reader.parse(new InputSource(inFileName)); + } + } else { + if (entityResolver != null) { + XMLReader reader = null; + + // Use JAXP1.1 ( if possible ) + try { + javax.xml.parsers.SAXParserFactory factory + = javax.xml.parsers.SAXParserFactory.newInstance(); + + factory.setNamespaceAware(true); + + if (isSecureProcessing) { + try { + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + } catch (org.xml.sax.SAXException se) { + } + } + + javax.xml.parsers.SAXParser jaxpParser + = factory.newSAXParser(); + + reader = jaxpParser.getXMLReader(); + } catch (javax.xml.parsers.ParserConfigurationException ex) { + throw new org.xml.sax.SAXException(ex); + } catch (javax.xml.parsers.FactoryConfigurationError ex1) { + throw new org.xml.sax.SAXException(ex1.toString()); + } catch (NoSuchMethodError ex2) { + } catch (AbstractMethodError ame) { + } + + if (null == reader) { + reader = XMLReaderFactory.createXMLReader(); + } + + reader.setEntityResolver(entityResolver); + + if (contentHandler != null) { + SAXResult result = new SAXResult(contentHandler); + + transformer.transform( + new SAXSource(reader, new InputSource(inFileName)), + result); + } else { + transformer.transform( + new SAXSource(reader, new InputSource(inFileName)), + strResult); + } + } else if (contentHandler != null) { + SAXResult result = new SAXResult(contentHandler); + + transformer.transform(new StreamSource(inFileName), result); + } else { + // System.out.println("Starting transform"); + transformer.transform(new StreamSource(inFileName), + strResult); + // System.out.println("Done with transform"); + } + } + } else { + StringReader reader + = new StringReader(" "); + + transformer.transform(new StreamSource(reader), strResult); + } + } else { + // "XSL Process was not successful."); + msg = "XSL Process was not successful."; + diagnosticsWriter.println(msg); + doExit(msg); + } + + // close output streams + if (null != outFileName && strResult != null) { + java.io.OutputStream out = strResult.getOutputStream(); + java.io.Writer writer = strResult.getWriter(); + try { + if (out != null) { + out.close(); + } + if (writer != null) { + writer.close(); + } + } catch (java.io.IOException ie) { + } + } + + long stop = System.currentTimeMillis(); + long millisecondsDuration = stop - start; + + if (doDiag) { + msg = " --------- Transform of " + inFileName + " via " + + xslFileName + " took " + millisecondsDuration + " ms"; + diagnosticsWriter.println('\n'); + diagnosticsWriter.println(msg); + } + + } catch (Throwable throwable) { + doStackDumpOnError = true; + + diagnosticsWriter.println(); + + if (doStackDumpOnError) { + throwable.printStackTrace(dumpWriter); + } else { + printLocation(diagnosticsWriter, throwable); + diagnosticsWriter.println("Unexpected exception: " + throwable); + } + + // diagnosticsWriter.println(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUCCESSFUL, null)); //"XSL Process was not successful."); + if (null != dumpFileName) { + dumpWriter.close(); + } + + doExit(throwable.getMessage()); + } + + if (null != dumpFileName) { + dumpWriter.close(); + } + + if (null != diagnosticsWriter) { + + // diagnosticsWriter.close(); + } + + // if(!setQuietMode) + // diagnosticsWriter.println(resbundle.getString("xsldone")); //"Xalan: done"); + // else + // diagnosticsWriter.println(""); //"Xalan: done"); + } + } + + /** + * It is _much_ easier to debug under VJ++ if I can set a single breakpoint + * before this blows itself out of the water... (I keep checking this in, it + * keeps vanishing. Grr!) + * + */ + static void doExit(String msg) { + throw new RuntimeException(msg); + } + + /** + * Wait for a return key to continue + * + * @param resbundle The resource bundle + */ + private static void waitForReturnKey() { + System.out.println("(press to continue)"); + try { + while (System.in.read() != '\n'); + } catch (java.io.IOException e) { + } + } + + /** + * Print a message if an option cannot be used with -XSLTC. + * + * @param option The option String + */ + private static void printInvalidXSLTCOption(String option) { + System.err.println("The option " + option + " is not supported in XSLTC mode."); + } + + /** + * Print a message if an option can only be used with -XSLTC. + * + * @param option The option String + */ + private static void printInvalidXalanOption(String option) { + System.err.println("The option " + option + " can only be used with -XSLTC."); + } + + static class DummyErrorListenerHandler implements ErrorHandler, ErrorListener { + @Override + public void warning(SAXParseException exception) throws SAXException { + System.err.println("WARNING: " + exception); + } + @Override + public void error(SAXParseException exception) throws SAXException { + throw exception; + } + @Override + public void fatalError(SAXParseException exception) throws SAXException { + throw exception; + } + @Override + public void warning(TransformerException exception) throws TransformerException { + System.err.println("WARNING: " + exception); + } + @Override + public void error(TransformerException exception) throws TransformerException { + throw exception; + } + @Override + public void fatalError(TransformerException exception) throws TransformerException { + throw exception; + } + } + + static ErrorListener createDefaultErrorListener() { + try { + Class errorHandler = + Class.forName("com.sun.org.apache.xml.internal.utils.DefaultErrorHandler"); + Constructor ctor = errorHandler.getConstructor(); + return (ErrorListener) ctor.newInstance(); + } catch (Throwable r) { + return new DummyErrorListenerHandler(); + } + } + + private static void printLocation(PrintWriter diagnosticsWriter, Throwable throwable) { + try { + Class errorHandler = + Class.forName("com.sun.org.apache.xml.internal.utils.DefaultErrorHandler"); + Method m = errorHandler.getMethod("printLocation", PrintWriter.class, Throwable.class); + m.invoke(null, diagnosticsWriter, throwable); + } catch (Throwable t) { + SourceLocator locator = null; + Throwable cause = throwable; + + // Try to find the locator closest to the cause. + do { + if (cause instanceof TransformerException) { + SourceLocator causeLocator = ((TransformerException) cause).getLocator(); + if (null != causeLocator) { + locator = causeLocator; + } + cause = ((TransformerException) cause).getCause(); + } else if (cause instanceof SAXException) { + cause = ((SAXException) cause).getException(); + } else { + cause = cause.getCause(); + } + } while (null != cause); + + if (null != locator) { + // m_pw.println("Parser fatal error: "+exception.getMessage()); + String id = (null != locator.getPublicId()) + ? locator.getPublicId() + : (null != locator.getSystemId()) + ? locator.getSystemId() : "SystemId Unknown"; //"SystemId Unknown"; + + diagnosticsWriter.print(id + "; " + "line: " + locator.getLineNumber() + + "; column: " + locator.getColumnNumber() + "; "); + } + diagnosticsWriter.print("(" + throwable + ": unknown location)"); + } + } + +} --- old/test/javax/xml/jaxp/internaltest/TEST.properties 2016-07-18 00:52:56.209130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,3 +0,0 @@ -# jaxp test uses TestNG -TestNG.dirs = javax/xml/common/bug6979306 javax/xml/parsers/bug8003147 javax/xml/transform/bug6551616 javax/xml/transform/cli - --- old/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java 2016-07-18 00:52:56.489130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2014, 2015, 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 - * @modules java.xml/com.sun.org.apache.bcel.internal.classfile - * java.xml/com.sun.org.apache.bcel.internal.generic - * @bug 8003147 - * @summary Test port fix for BCEL bug 39695. - */ - -import java.io.FileOutputStream; -import java.util.ArrayList; - -import org.testng.Assert; -import org.testng.annotations.Test; - -import com.sun.org.apache.bcel.internal.classfile.ClassParser; -import com.sun.org.apache.bcel.internal.classfile.ConstantClass; -import com.sun.org.apache.bcel.internal.classfile.ConstantPool; -import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8; -import com.sun.org.apache.bcel.internal.classfile.JavaClass; -import com.sun.org.apache.bcel.internal.classfile.Method; -import com.sun.org.apache.bcel.internal.generic.ClassGen; -import com.sun.org.apache.bcel.internal.generic.MethodGen; - -public class Bug8003147Test { - - @Test - public void test() throws Exception { - String classfile = getClass().getResource("Bug8003147Test.class").getPath(); - JavaClass jc = new ClassParser(classfile).parse(); - // rename class - ConstantPool cp = jc.getConstantPool(); - int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex(); - cp.setConstant(cpIndex, new ConstantUtf8("Bug8003147TestPrime")); - ClassGen gen = new ClassGen(jc); - Method[] methods = jc.getMethods(); - int index; - for (index = 0; index < methods.length; index++) { - if (methods[index].getName().equals("doSomething")) { - break; - } - } - Method m = methods[index]; - MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool()); - gen.replaceMethod(m, mg.getMethod()); - String path = classfile.replace("Bug8003147Test", "Bug8003147TestPrime"); - gen.getJavaClass().dump(new FileOutputStream(path)); - - try { - Class.forName("Bug8003147TestPrime"); - } catch (ClassFormatError cfe) { - cfe.printStackTrace(); - Assert.fail("modified version of class does not pass verification"); - } - } - - public void doSomething(double d, ArrayList list) { - } -} --- old/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java 2016-07-18 00:52:56.764130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2014, 2015, 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 - * @modules java.xml/com.sun.org.apache.xalan.internal.xsltc.trax - * @bug 6551616 - * @summary Test SAX2StAXEventWriter. - */ - -import java.io.InputStream; -import java.io.StringBufferInputStream; - -import javax.xml.stream.XMLEventWriter; -import javax.xml.stream.XMLOutputFactory; - -import org.testng.annotations.Test; - -import com.sun.org.apache.xalan.internal.xsltc.trax.SAX2StAXEventWriter; - -public class Bug6551616 { - String _cache = ""; - - - @Test - public void test() throws Exception { - final String XML = "" + "" + "

Test

"; - - javax.xml.parsers.SAXParserFactory saxFactory = javax.xml.parsers.SAXParserFactory.newInstance(); - - javax.xml.parsers.SAXParser parser = saxFactory.newSAXParser(); - - XMLOutputFactory outFactory = XMLOutputFactory.newInstance(); - XMLEventWriter writer = outFactory.createXMLEventWriter(System.out); - - SAX2StAXEventWriter handler = new SAX2StAXEventWriter(writer); - - InputStream is = new StringBufferInputStream(XML); - - parser.parse(is, handler); - - // if it doesn't blow up, it succeeded. - } -} --- old/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java 2016-07-18 00:52:57.038130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2014, 2015, 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 - * @modules java.xml/com.sun.org.apache.xml.internal.utils - * @summary Test internal transform CLI. - */ - -import org.testng.Assert; -import org.testng.annotations.Test; - -public class CLITest { - - @Test - public void testCLI() { - try { - String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(), "-IN", - getClass().getResource("tigertest-in.xml").toString(), }; - ProcessXSLT.main(args); - } catch (Exception e) { - Assert.fail(e.getMessage()); - } - } -} --- old/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java 2016-07-18 00:52:57.322130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,913 +0,0 @@ -/* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ -/* - * Copyright 1999-2004 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * $Id: Process.java,v 1.2.4.2 2005/09/15 18:21:57 jeffsuttor Exp $ - */ - -// This file is a copied and modified version of -// com/sun/org/apache/xalan/internal/xslt/Process.java -// which has been modified to only use public exported APIs. -// The only adherence is with -// com.sun.org.apache.xml.internal.utils.DefaultErrorHandler -// which we try to instantiate using reflection, as that class -// can do a better job at reporting error location. -// We however don't have a hard dependency on it. We will use -// our own ErrorHandler if the default one is not accessible. -// -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.PrintWriter; -import java.io.StringReader; -import java.util.Properties; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Source; -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerFactoryConfigurationError; -import javax.xml.transform.URIResolver; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.sax.SAXTransformerFactory; -import javax.xml.transform.sax.TransformerHandler; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import javax.xml.transform.ErrorListener; -import javax.xml.transform.SourceLocator; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -import org.xml.sax.ContentHandler; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.XMLReaderFactory; - -/** - * The main() method handles the Xalan command-line interface. - */ -public class ProcessXSLT -{ - - /** - * Prints argument options. - * - */ - protected static void printArgOptions() { - System.out.println("xslproc options: "); - System.out.println("\n\t\t\t" + "-Common Options-" + "\n"); - System.out.println(" [-XSLTC (use XSLTC for transformation)]"); //" [-XSLTC (use XSLTC for transformation)] - System.out.println(" [-IN inputXMLURL]"); //" [-IN inputXMLURL]"); - System.out.println(" [-XSL XSLTransformationURL]"); //" [-XSL XSLTransformationURL]"); - System.out.println(" [-OUT outputFileName]"); //" [-OUT outputFileName]"); - - System.out.println(" [-E (Do not expand entity refs)]"); //" [-V (Version info)]"); - - System.out.println(" [-EDUMP {optional filename} (Do stackdump on error.)]"); //" [-EDUMP {optional filename} (Do stackdump on error.)]"); - System.out.println(" [-XML (Use XML formatter and add XML header.)]"); //" [-XML (Use XML formatter and add XML header.)]"); - System.out.println(" [-TEXT (Use simple Text formatter.)]"); //" [-TEXT (Use simple Text formatter.)]"); - System.out.println(" [-HTML (Use HTML formatter.)]"); //" [-HTML (Use HTML formatter.)]"); - System.out.println( " [-PARAM name expression (Set a stylesheet parameter)]"); //" [-PARAM name expression (Set a stylesheet parameter)]"); - - System.out.println(" [-MEDIA mediaType (use media attribute to find stylesheet associated with a document.)]"); - System.out.println(" [-FLAVOR flavorName (Explicitly use s2s=SAX or d2d=DOM to do transform.)] "); - System.out.println(" [-DIAG (Print overall milliseconds transform took.)]"); - System.out.println(" [-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]"); //" [-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]"); - System.out.println(" [-ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities)]"); //" [-ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities)]"); - waitForReturnKey(); - System.out.println(" [-CONTENTHANDLER full class name (ContentHandler to be used to serialize output)]"); //" [-CONTENTHANDLER full class name (ContentHandler to be used to serialize output)]"); - System.out.println(" [-SECURE (set the secure processing feature to true.)]"); //" [-SECURE (set the secure processing feature to true)]"); - - - System.out.println("\n\t\t\t"+ "-Options for XSLTC-" + "\n"); - System.out.println(" [-XO [transletName] (assign the name to the generated translet)]"); - waitForReturnKey(); - System.out.println(" [-XD destinationDirectory (specify a destination directory for translet)]"); - System.out.println(" [-XJ jarfile (packages translet classes into a jar file of name )]"); - System.out.println(" [-XP package (specifies a package name prefix for all generated translet classes)]"); - System.out.println(" [-XN (enables template inlining)]"); - System.out.println(" [-XX (turns on additional debugging message output)]"); - System.out.println(" [-XT (use translet to transform if possible)]"); - } - - /** - * Command line interface to transform an XML document according to - * the instructions found in an XSL stylesheet. - *

The Process class provides basic functionality for - * performing transformations from the command line. To see a - * list of arguments supported, call with zero arguments.

- *

To set stylesheet parameters from the command line, use - * -PARAM name expression. If you want to set the - * parameter to a string value, simply pass the string value - * as-is, and it will be interpreted as a string. (Note: if - * the value has spaces in it, you may need to quote it depending - * on your shell environment).

- * - * @param argv Input parameters from command line - */ - public static void main(String argv[]) { - - // Runtime.getRuntime().traceMethodCalls(false); // turns Java tracing off - boolean doStackDumpOnError = false; - boolean doDiag = false; - boolean setQuietMode = false; - String msg = null; - boolean isSecureProcessing = false; - - // Runtime.getRuntime().traceMethodCalls(false); - // Runtime.getRuntime().traceInstructions(false); - /** - * The default diagnostic writer... - */ - java.io.PrintWriter diagnosticsWriter = new PrintWriter(System.err, true); - java.io.PrintWriter dumpWriter = diagnosticsWriter; - String flavor = "s2s"; - - if (argv.length < 1) { - printArgOptions(); - } else { - // J2SE does not support Xalan interpretive - // false -> true - boolean useXSLTC = true; - for (int i = 0; i < argv.length; i++) { - if ("-XSLTC".equalsIgnoreCase(argv[i])) { - useXSLTC = true; - } - } - - TransformerFactory tfactory; - if (useXSLTC) { - String key = "javax.xml.transform.TransformerFactory"; - String value = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"; - Properties props = System.getProperties(); - props.put(key, value); - System.setProperties(props); - } - - try { - tfactory = TransformerFactory.newInstance(); - tfactory.setErrorListener(createDefaultErrorListener()); - } catch (TransformerFactoryConfigurationError pfe) { - pfe.printStackTrace(dumpWriter); - // "XSL Process was not successful."); - msg = "XSL Process was not successful."; - diagnosticsWriter.println(msg); - - tfactory = null; // shut up compiler - - doExit(msg); - } - - boolean formatOutput = false; - boolean useSourceLocation = false; - String inFileName = null; - String outFileName = null; - String dumpFileName = null; - String xslFileName = null; - String treedumpFileName = null; - String outputType = null; - String media = null; - List params = new ArrayList<>(); - boolean quietConflictWarnings = false; - URIResolver uriResolver = null; - EntityResolver entityResolver = null; - ContentHandler contentHandler = null; - int recursionLimit = -1; - - for (int i = 0; i < argv.length; i++) { - if ("-XSLTC".equalsIgnoreCase(argv[i])) { - // The -XSLTC option has been processed. - } // J2SE does not support Xalan interpretive - else if ("-INDENT".equalsIgnoreCase(argv[i])) { - int indentAmount; - - if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-')) { - indentAmount = Integer.parseInt(argv[++i]); - } else { - indentAmount = 0; - } - - } else if ("-IN".equalsIgnoreCase(argv[i])) { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - inFileName = argv[++i]; - } else { - System.err.println("Missing argument for -IN"); - } - } else if ("-MEDIA".equalsIgnoreCase(argv[i])) { - if (i + 1 < argv.length) { - media = argv[++i]; - } else { - System.err.println("Missing argument for -MEDIA"); //"Missing argument for); - } - } else if ("-OUT".equalsIgnoreCase(argv[i])) { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - outFileName = argv[++i]; - } else { - System.err.println("Missing argument for -OUT"); //"Missing argument for); - } - } else if ("-XSL".equalsIgnoreCase(argv[i])) { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - xslFileName = argv[++i]; - } else { - System.err.println("Missing argument for -XSL"); //"Missing argument for); - } - } else if ("-FLAVOR".equalsIgnoreCase(argv[i])) { - if (i + 1 < argv.length) { - flavor = argv[++i]; - } else { - System.err.println("Missing argument for -FLAVOR"); //"Missing argument for); - } - } else if ("-PARAM".equalsIgnoreCase(argv[i])) { - if (i + 2 < argv.length) { - String name = argv[++i]; - - params.add(name); - - String expression = argv[++i]; - - params.add(expression); - } else { - System.err.println("Missing argument for -PARAM"); //"Missing argument for); - } - } else if ("-E".equalsIgnoreCase(argv[i])) { - - } else if ("-V".equalsIgnoreCase(argv[i])) { - diagnosticsWriter.println(">>>>>>> Java Version " - + System.getProperty("java.version") + ", " - + /* xmlProcessorLiaison.getParserDescription()+ */ "<<<<<<<"); - } // J2SE does not support Xalan interpretive - /* - else if ("-QC".equalsIgnoreCase(argv[i])) - { - if (!useXSLTC) - quietConflictWarnings = true; - else - printInvalidXSLTCOption("-QC"); - } - */ else if ("-Q".equalsIgnoreCase(argv[i])) { - setQuietMode = true; - } else if ("-DIAG".equalsIgnoreCase(argv[i])) { - doDiag = true; - } else if ("-XML".equalsIgnoreCase(argv[i])) { - outputType = "xml"; - } else if ("-TEXT".equalsIgnoreCase(argv[i])) { - outputType = "text"; - } else if ("-HTML".equalsIgnoreCase(argv[i])) { - outputType = "html"; - } else if ("-EDUMP".equalsIgnoreCase(argv[i])) { - doStackDumpOnError = true; - - if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-')) { - dumpFileName = argv[++i]; - } - } else if ("-URIRESOLVER".equalsIgnoreCase(argv[i])) { - if (i + 1 < argv.length) { - try { - Class uriResolverClass = Class.forName(argv[++i]); - Constructor ctor = uriResolverClass.getConstructor(); - ctor.setAccessible(true); - uriResolver = (URIResolver) ctor.newInstance(); - - tfactory.setURIResolver(uriResolver); - } catch (Throwable cnfe) { - msg = "Class not found for option -URIResolver"; - System.err.println(msg); - doExit(msg); - } - } else { - msg = "Missing argument for -URIResolver"; - System.err.println(msg); //"Missing argument for); - doExit(msg); - } - } else if ("-ENTITYRESOLVER".equalsIgnoreCase(argv[i])) { - if (i + 1 < argv.length) { - try { - Class entityResolverClass = Class.forName(argv[++i]); - Constructor ctor = entityResolverClass.getConstructor(); - ctor.setAccessible(true); - entityResolver = (EntityResolver) ctor.newInstance(); - } catch (Throwable cnfe) { - msg = "Class not found for option -EntityResolver"; - System.err.println(msg); - doExit(msg); - } - } else { - // "Missing argument for); - msg = "Missing argument for -EntityResolver"; - System.err.println(msg); - doExit(msg); - } - } else if ("-CONTENTHANDLER".equalsIgnoreCase(argv[i])) { - if (i + 1 < argv.length) { - try { - Class contentHandlerClass = Class.forName(argv[++i]); - Constructor ctor = contentHandlerClass.getConstructor(); - ctor.setAccessible(true); - contentHandler = (ContentHandler) ctor.newInstance(); - } catch (Throwable cnfe) { - msg = "Class not found for option -ContentHandler"; - System.err.println(msg); - doExit(msg); - } - } else { - // "Missing argument for); - msg = "Missing argument for -ContentHandler"; - System.err.println(msg); - doExit(msg); - } - } else if ("-XO".equalsIgnoreCase(argv[i])) { - if (useXSLTC) { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - tfactory.setAttribute("generate-translet", "true"); - tfactory.setAttribute("translet-name", argv[++i]); - } else { - tfactory.setAttribute("generate-translet", "true"); - } - } else { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - i++; - } - printInvalidXalanOption("-XO"); - } - } // Specify the destination directory for the translet classes. - else if ("-XD".equalsIgnoreCase(argv[i])) { - if (useXSLTC) { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - tfactory.setAttribute("destination-directory", argv[++i]); - } else { - System.err.println("Missing argument for -XD"); //"Missing argument for); - } - } else { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - i++; - } - - printInvalidXalanOption("-XD"); - } - } // Specify the jar file name which the translet classes are packaged into. - else if ("-XJ".equalsIgnoreCase(argv[i])) { - if (useXSLTC) { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - tfactory.setAttribute("generate-translet", "true"); - tfactory.setAttribute("jar-name", argv[++i]); - } else { - System.err.println("Missing argument for -XJ"); //"Missing argument for); - } - } else { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - i++; - } - - printInvalidXalanOption("-XJ"); - } - - } // Specify the package name prefix for the generated translet classes. - else if ("-XP".equalsIgnoreCase(argv[i])) { - if (useXSLTC) { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - tfactory.setAttribute("package-name", argv[++i]); - } else { - System.err.println("Missing argument for -XP"); //"Missing argument for); - } - } else { - if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') { - i++; - } - - printInvalidXalanOption("-XP"); - } - - } // Enable template inlining. - else if ("-XN".equalsIgnoreCase(argv[i])) { - if (useXSLTC) { - tfactory.setAttribute("enable-inlining", "true"); - } else { - printInvalidXalanOption("-XN"); - } - } // Turns on additional debugging message output - else if ("-XX".equalsIgnoreCase(argv[i])) { - if (useXSLTC) { - tfactory.setAttribute("debug", "true"); - } else { - printInvalidXalanOption("-XX"); - } - } // Create the Transformer from the translet if the translet class is newer - // than the stylesheet. - else if ("-XT".equalsIgnoreCase(argv[i])) { - if (useXSLTC) { - tfactory.setAttribute("auto-translet", "true"); - } else { - printInvalidXalanOption("-XT"); - } - } else if ("-SECURE".equalsIgnoreCase(argv[i])) { - isSecureProcessing = true; - try { - tfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } catch (TransformerConfigurationException e) { - } - } else { - System.err.println("Invalid argument: " + argv[i]); //"Invalid argument:); - } - } - - // Print usage instructions if no xml and xsl file is specified in the command line - if (inFileName == null && xslFileName == null) { - msg = "Error: No stylesheet or input xml is specified. Run this command without any option for usage instructions."; - System.err.println(msg); - doExit(msg); - } - - // Note that there are usage cases for calling us without a -IN arg - // The main XSL transformation occurs here! - try { - long start = System.currentTimeMillis(); - - if (null != dumpFileName) { - dumpWriter = new PrintWriter(new FileWriter(dumpFileName)); - } - - Templates stylesheet = null; - - if (null != xslFileName) { - if (flavor.equals("d2d")) { - - // Parse in the xml data into a DOM - DocumentBuilderFactory dfactory - = DocumentBuilderFactory.newInstance(); - - dfactory.setNamespaceAware(true); - - if (isSecureProcessing) { - try { - dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } catch (ParserConfigurationException pce) { - } - } - - DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); - Node xslDOM = docBuilder.parse(new InputSource(xslFileName)); - - stylesheet = tfactory.newTemplates(new DOMSource(xslDOM, - xslFileName)); - } else { - // System.out.println("Calling newTemplates: "+xslFileName); - stylesheet = tfactory.newTemplates(new StreamSource(xslFileName)); - // System.out.println("Done calling newTemplates: "+xslFileName); - } - } - - PrintWriter resultWriter; - StreamResult strResult; - - if (null != outFileName) { - strResult = new StreamResult(new FileOutputStream(outFileName)); - // One possible improvement might be to ensure this is - // a valid URI before setting the systemId, but that - // might have subtle changes that pre-existing users - // might notice; we can think about that later -sc r1.46 - strResult.setSystemId(outFileName); - } else { - strResult = new StreamResult(System.out); - // We used to default to incremental mode in this case. - // We've since decided that since the -INCREMENTAL switch is - // available, that default is probably not necessary nor - // necessarily a good idea. - } - - SAXTransformerFactory stf = (SAXTransformerFactory) tfactory; - - // Did they pass in a stylesheet, or should we get it from the - // document? - if (null == stylesheet) { - Source source - = stf.getAssociatedStylesheet(new StreamSource(inFileName), media, - null, null); - - if (null != source) { - stylesheet = tfactory.newTemplates(source); - } else { - if (null != media) { - throw new TransformerException("No stylesheet found in: " - + inFileName + ", media=" + media); //"No stylesheet found in: " - } // + inFileName + ", media=" - // + media); - else { - throw new TransformerException("No xml-stylesheet PI found in: " + inFileName); //"No xml-stylesheet PI found in: " - } //+ inFileName); - } - } - - if (null != stylesheet) { - Transformer transformer = flavor.equals("th") ? null : stylesheet.newTransformer(); - transformer.setErrorListener(createDefaultErrorListener()); - - // Override the output format? - if (null != outputType) { - transformer.setOutputProperty(OutputKeys.METHOD, outputType); - } - - int nParams = params.size(); - - for (int i = 0; i < nParams; i += 2) { - transformer.setParameter((String) params.get(i), - (String) params.get(i + 1)); - } - - if (uriResolver != null) { - transformer.setURIResolver(uriResolver); - } - - if (null != inFileName) { - if (flavor.equals("d2d")) { - - // Parse in the xml data into a DOM - DocumentBuilderFactory dfactory - = DocumentBuilderFactory.newInstance(); - - dfactory.setCoalescing(true); - dfactory.setNamespaceAware(true); - - if (isSecureProcessing) { - try { - dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } catch (ParserConfigurationException pce) { - } - } - - DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); - - if (entityResolver != null) { - docBuilder.setEntityResolver(entityResolver); - } - - Node xmlDoc = docBuilder.parse(new InputSource(inFileName)); - Document doc = docBuilder.newDocument(); - org.w3c.dom.DocumentFragment outNode - = doc.createDocumentFragment(); - - transformer.transform(new DOMSource(xmlDoc, inFileName), - new DOMResult(outNode)); - - // Now serialize output to disk with identity transformer - Transformer serializer = stf.newTransformer(); - serializer.setErrorListener(createDefaultErrorListener()); - - Properties serializationProps - = stylesheet.getOutputProperties(); - - serializer.setOutputProperties(serializationProps); - - if (contentHandler != null) { - SAXResult result = new SAXResult(contentHandler); - - serializer.transform(new DOMSource(outNode), result); - } else { - serializer.transform(new DOMSource(outNode), strResult); - } - } else if (flavor.equals("th")) { - for (int i = 0; i < 1; i++) // Loop for diagnosing bugs with inconsistent behavior - { - // System.out.println("Testing the TransformerHandler..."); - - XMLReader reader = null; - - // Use JAXP1.1 ( if possible ) - try { - javax.xml.parsers.SAXParserFactory factory - = javax.xml.parsers.SAXParserFactory.newInstance(); - - factory.setNamespaceAware(true); - - if (isSecureProcessing) { - try { - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } catch (org.xml.sax.SAXException se) { - } - } - - javax.xml.parsers.SAXParser jaxpParser - = factory.newSAXParser(); - - reader = jaxpParser.getXMLReader(); - } catch (javax.xml.parsers.ParserConfigurationException ex) { - throw new org.xml.sax.SAXException(ex); - } catch (javax.xml.parsers.FactoryConfigurationError ex1) { - throw new org.xml.sax.SAXException(ex1.toString()); - } catch (NoSuchMethodError ex2) { - } catch (AbstractMethodError ame) { - } - - if (null == reader) { - reader = XMLReaderFactory.createXMLReader(); - } - - TransformerHandler th = stf.newTransformerHandler(stylesheet); - - reader.setContentHandler(th); - reader.setDTDHandler(th); - - if (th instanceof org.xml.sax.ErrorHandler) { - reader.setErrorHandler((org.xml.sax.ErrorHandler) th); - } - - try { - reader.setProperty( - "http://xml.org/sax/properties/lexical-handler", th); - } catch (org.xml.sax.SAXNotRecognizedException e) { - } catch (org.xml.sax.SAXNotSupportedException e) { - } - try { - reader.setFeature("http://xml.org/sax/features/namespace-prefixes", - true); - } catch (org.xml.sax.SAXException se) { - } - - th.setResult(strResult); - - reader.parse(new InputSource(inFileName)); - } - } else { - if (entityResolver != null) { - XMLReader reader = null; - - // Use JAXP1.1 ( if possible ) - try { - javax.xml.parsers.SAXParserFactory factory - = javax.xml.parsers.SAXParserFactory.newInstance(); - - factory.setNamespaceAware(true); - - if (isSecureProcessing) { - try { - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } catch (org.xml.sax.SAXException se) { - } - } - - javax.xml.parsers.SAXParser jaxpParser - = factory.newSAXParser(); - - reader = jaxpParser.getXMLReader(); - } catch (javax.xml.parsers.ParserConfigurationException ex) { - throw new org.xml.sax.SAXException(ex); - } catch (javax.xml.parsers.FactoryConfigurationError ex1) { - throw new org.xml.sax.SAXException(ex1.toString()); - } catch (NoSuchMethodError ex2) { - } catch (AbstractMethodError ame) { - } - - if (null == reader) { - reader = XMLReaderFactory.createXMLReader(); - } - - reader.setEntityResolver(entityResolver); - - if (contentHandler != null) { - SAXResult result = new SAXResult(contentHandler); - - transformer.transform( - new SAXSource(reader, new InputSource(inFileName)), - result); - } else { - transformer.transform( - new SAXSource(reader, new InputSource(inFileName)), - strResult); - } - } else if (contentHandler != null) { - SAXResult result = new SAXResult(contentHandler); - - transformer.transform(new StreamSource(inFileName), result); - } else { - // System.out.println("Starting transform"); - transformer.transform(new StreamSource(inFileName), - strResult); - // System.out.println("Done with transform"); - } - } - } else { - StringReader reader - = new StringReader(" "); - - transformer.transform(new StreamSource(reader), strResult); - } - } else { - // "XSL Process was not successful."); - msg = "XSL Process was not successful."; - diagnosticsWriter.println(msg); - doExit(msg); - } - - // close output streams - if (null != outFileName && strResult != null) { - java.io.OutputStream out = strResult.getOutputStream(); - java.io.Writer writer = strResult.getWriter(); - try { - if (out != null) { - out.close(); - } - if (writer != null) { - writer.close(); - } - } catch (java.io.IOException ie) { - } - } - - long stop = System.currentTimeMillis(); - long millisecondsDuration = stop - start; - - if (doDiag) { - msg = " --------- Transform of " + inFileName + " via " - + xslFileName + " took " + millisecondsDuration + " ms"; - diagnosticsWriter.println('\n'); - diagnosticsWriter.println(msg); - } - - } catch (Throwable throwable) { - doStackDumpOnError = true; - - diagnosticsWriter.println(); - - if (doStackDumpOnError) { - throwable.printStackTrace(dumpWriter); - } else { - printLocation(diagnosticsWriter, throwable); - diagnosticsWriter.println("Unexpected exception: " + throwable); - } - - // diagnosticsWriter.println(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUCCESSFUL, null)); //"XSL Process was not successful."); - if (null != dumpFileName) { - dumpWriter.close(); - } - - doExit(throwable.getMessage()); - } - - if (null != dumpFileName) { - dumpWriter.close(); - } - - if (null != diagnosticsWriter) { - - // diagnosticsWriter.close(); - } - - // if(!setQuietMode) - // diagnosticsWriter.println(resbundle.getString("xsldone")); //"Xalan: done"); - // else - // diagnosticsWriter.println(""); //"Xalan: done"); - } - } - - /** - * It is _much_ easier to debug under VJ++ if I can set a single breakpoint - * before this blows itself out of the water... (I keep checking this in, it - * keeps vanishing. Grr!) - * - */ - static void doExit(String msg) { - throw new RuntimeException(msg); - } - - /** - * Wait for a return key to continue - * - * @param resbundle The resource bundle - */ - private static void waitForReturnKey() { - System.out.println("(press to continue)"); - try { - while (System.in.read() != '\n'); - } catch (java.io.IOException e) { - } - } - - /** - * Print a message if an option cannot be used with -XSLTC. - * - * @param option The option String - */ - private static void printInvalidXSLTCOption(String option) { - System.err.println("The option " + option + " is not supported in XSLTC mode."); - } - - /** - * Print a message if an option can only be used with -XSLTC. - * - * @param option The option String - */ - private static void printInvalidXalanOption(String option) { - System.err.println("The option " + option + " can only be used with -XSLTC."); - } - - static class DummyErrorListenerHandler implements ErrorHandler, ErrorListener { - @Override - public void warning(SAXParseException exception) throws SAXException { - System.err.println("WARNING: " + exception); - } - @Override - public void error(SAXParseException exception) throws SAXException { - throw exception; - } - @Override - public void fatalError(SAXParseException exception) throws SAXException { - throw exception; - } - @Override - public void warning(TransformerException exception) throws TransformerException { - System.err.println("WARNING: " + exception); - } - @Override - public void error(TransformerException exception) throws TransformerException { - throw exception; - } - @Override - public void fatalError(TransformerException exception) throws TransformerException { - throw exception; - } - } - - static ErrorListener createDefaultErrorListener() { - try { - Class errorHandler = - Class.forName("com.sun.org.apache.xml.internal.utils.DefaultErrorHandler"); - Constructor ctor = errorHandler.getConstructor(); - return (ErrorListener) ctor.newInstance(); - } catch (Throwable r) { - return new DummyErrorListenerHandler(); - } - } - - private static void printLocation(PrintWriter diagnosticsWriter, Throwable throwable) { - try { - Class errorHandler = - Class.forName("com.sun.org.apache.xml.internal.utils.DefaultErrorHandler"); - Method m = errorHandler.getMethod("printLocation", PrintWriter.class, Throwable.class); - m.invoke(null, diagnosticsWriter, throwable); - } catch (Throwable t) { - SourceLocator locator = null; - Throwable cause = throwable; - - // Try to find the locator closest to the cause. - do { - if (cause instanceof TransformerException) { - SourceLocator causeLocator = ((TransformerException) cause).getLocator(); - if (null != causeLocator) { - locator = causeLocator; - } - cause = ((TransformerException) cause).getCause(); - } else if (cause instanceof SAXException) { - cause = ((SAXException) cause).getException(); - } else { - cause = cause.getCause(); - } - } while (null != cause); - - if (null != locator) { - // m_pw.println("Parser fatal error: "+exception.getMessage()); - String id = (null != locator.getPublicId()) - ? locator.getPublicId() - : (null != locator.getSystemId()) - ? locator.getSystemId() : "SystemId Unknown"; //"SystemId Unknown"; - - diagnosticsWriter.print(id + "; " + "line: " + locator.getLineNumber() - + "; column: " + locator.getColumnNumber() + "; "); - } - diagnosticsWriter.print("(" + throwable + ": unknown location)"); - } - } - -} --- old/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml 2016-07-18 00:52:57.647130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,7 +0,0 @@ - - - - - - - --- old/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl 2016-07-18 00:52:57.932130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - --- old/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java 2016-07-18 00:52:58.229130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ -package jaxp.library; - -import java.security.Permission; -import java.security.Permissions; -import java.security.Policy; -import java.util.PropertyPermission; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; - -/** - * This is a base class that every test class must extend if it needs to be run - * with security mode. - */ -public class JAXPBaseTest { - /** - * Backing up policy. - */ - protected static Policy policy; - - /** - * Backing up security manager. - */ - private static SecurityManager sm; - - /* - * Install a SecurityManager along with a base Policy to allow testNG to - * run when there is a security manager. - */ - @BeforeClass - public void setUpClass() throws Exception { - setPolicy(new TestPolicy()); - System.setSecurityManager(new SecurityManager()); - } - - /* - * Install the original Policy and SecurityManager when there is a security - * manager. - */ - @AfterClass - public void tearDownClass() throws Exception { - System.setSecurityManager(sm); - setPolicy(policy); - } - - /* - * Utility Method used to set the current Policy. - */ - protected static void setPolicy(Policy p) { - Policy.setPolicy(p); - } - - /* - * Add the specified permission(s) to the test policy. - * Note there is no way to add permissions to current permissions. Reset - * test policy by setting minimal permmisons in addition to specified - * permissions when calling this method. - */ - protected static void setPermissions(Permission... ps) { - Policy.setPolicy(new TestPolicy(ps)); - } - - /* - * Add the specified permission(s) to the test policy. - * Note there is no way to add permissions to current permissions. Reset - * test policy by setting minimal permmisons in addition to specified - * permissions when calling this method. - */ - protected static void setPermissions(Permissions ps) { - Policy.setPolicy(new TestPolicy(ps)); - } - - /** - * Backing up policy and security manager for restore when there is a - * security manager. - */ - public JAXPBaseTest() { - policy = Policy.getPolicy(); - sm = System.getSecurityManager(); - } - - /** - * Safety acquire a system property. - * Note invocation of this method will restore permission to limited - * minimal permission of tests. If there is additional permission set - * already, you need restore permission by yourself. - * @param propName System property name to be acquired. - * @return property value - */ - protected String getSystemProperty(final String propName) { - setPermissions(new PropertyPermission(propName, "read")); - try { - return System.getProperty(propName); - } finally { - setPermissions(); - } - } - - /** - * Safety set a system property by given system value. - * - * @param propName System property name to be set. - * @param propValue System property value to be set. - */ - protected void setSystemProperty(final String propName, final String propValue) { - setPermissions(new PropertyPermission(propName, "write")); - try { - if (propValue == null) { - System.clearProperty(propName); - } else { - System.setProperty(propName, propValue); - } - } finally { - setPermissions(); - } - } -} --- old/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java 2016-07-18 00:52:58.507130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ -package jaxp.library; - -import java.io.FilePermission; -import java.security.Permission; -import java.security.Permissions; -import java.security.Policy; -import static jaxp.library.JAXPBaseTest.setPolicy; -import org.testng.annotations.BeforeClass; - -/** - * This is a base class that every test class that need to access local XML - * files must extend if it needs to be run with security mode. - */ -public class JAXPFileBaseTest extends JAXPBaseTest { - /* - * Install a SecurityManager along with a base Policy to allow testNG to - * run when there is a security manager. - */ - @BeforeClass - @Override - public void setUpClass() throws Exception { - setPolicy(new FileTestPolicy()); - System.setSecurityManager(new SecurityManager()); - } - - /* - * Add the specified permission(s) to the test policy. - * Note there is no way to add permissions to current permissions. Reset - * test policy by setting minimal permmisons in addition to specified - * permissions when calling this method. - */ - protected static void setPermissions(Permission... ps) { - Policy.setPolicy(new FileTestPolicy(ps)); - } - - /* - * Add the specified permission(s) to the test policy. - * Note there is no way to add permissions to current permissions. Reset - * test policy by setting minimal permmisons in addition to specified - * permissions when calling this method. - */ - protected static void setPermissions(Permissions ps) { - Policy.setPolicy(new FileTestPolicy(ps)); - } -} - -/** - * This policy is only given to tests that need access local files. Additional - * permissions for accessing local files have been granted by default. - * @author HaiboYan - */ -class FileTestPolicy extends TestPolicy { - /** - * Constructor which sets the minimum permissions by default allowing testNG - * to work with a SecurityManager. - * @param ps permissions to be added. - */ - public FileTestPolicy(Permissions ps) { - super(ps); - } - - /** - * Constructor which sets the minimum permissions by default allowing testNG - * to work with a SecurityManager. - * @param ps permission array to be added. - */ - public FileTestPolicy(Permission... ps) { - super(ps); - } - - /** - * Defines the minimal permissions required by testNG when running these - * tests - */ - @Override - protected void setMinimalPermissions() { - super.setMinimalPermissions(); - permissions.add(new FilePermission(System.getProperty("user.dir") + "/-", - "read, write")); - permissions.add(new FilePermission(System.getProperty("test.src") + "/-", - "read")); - } -} --- old/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileReadOnlyBaseTest.java 2016-07-18 00:52:58.793130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ -package jaxp.library; - -import java.io.FilePermission; -import static jaxp.library.JAXPBaseTest.setPermissions; -import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; - -/** - * This is a base class that every test class that need to reading local XML - * files must extend if it needs to be run with security mode. - */ -public class JAXPFileReadOnlyBaseTest extends JAXPBaseTest { - /** - * Source files/XML files directory. - */ - private final String SRC_DIR = getSystemProperty("test.src"); - - /** - * Allowing access local file system for this group. - */ - @BeforeGroups (groups = {"readLocalFiles"}) - public void setFilePermissions() { - setPermissions(new FilePermission(SRC_DIR + "/-", "read")); - } - - /** - * Restore the system property. - */ - @AfterGroups (groups = {"readLocalFiles"}) - public void restoreFilePermissions() { - setPermissions(); - } -} --- old/test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java 2016-07-18 00:52:59.075130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ -package jaxp.library; - -import java.security.AllPermission; -import java.security.CodeSource; -import java.security.Permission; -import java.security.PermissionCollection; -import java.security.Permissions; -import java.security.Policy; -import java.security.ProtectionDomain; -import java.security.SecurityPermission; -import java.util.Arrays; -import java.util.Collections; -import java.util.Enumeration; -import java.util.PropertyPermission; -import java.util.StringJoiner; - - -/* - * Simple Policy class that supports the required Permissions to validate the - * JAXP concrete classes. - * Note: permission can only be added. You may want to create a new TestPolicy - * instance if you need remove permissions. - */ -public class TestPolicy extends Policy { - protected final PermissionCollection permissions = new Permissions(); - - private static Policy defaultPolicy = Policy.getPolicy(); - - /** - * Constructor which sets the minimum permissions by default allowing testNG - * to work with a SecurityManager. - */ - public TestPolicy() { - setMinimalPermissions(); - } - - /** - * Construct an instance with the minimal permissions required by the test - * environment and additional permission(s) as specified. - * @param ps permissions to be added. - */ - public TestPolicy(Permissions ps) { - setMinimalPermissions(); - TestPolicy.this.addPermissions(ps); - } - - /** - * Construct an instance with the minimal permissions required by the test - * environment and additional permission(s) as specified. - * @param ps permission array to be added. - */ - public TestPolicy(Permission... ps) { - setMinimalPermissions(); - addPermissions(ps); - } - - /** - * Defines the minimal permissions required by testNG when running these - * tests - */ - protected void setMinimalPermissions() { - permissions.add(new SecurityPermission("getPolicy")); - permissions.add(new SecurityPermission("setPolicy")); - permissions.add(new RuntimePermission("getClassLoader")); - permissions.add(new RuntimePermission("setSecurityManager")); - permissions.add(new RuntimePermission("createSecurityManager")); - permissions.add(new PropertyPermission("testng.show.stack.frames", - "read")); - permissions.add(new PropertyPermission("user.dir", "read")); - permissions.add(new PropertyPermission("test.src", "read")); - permissions.add(new PropertyPermission("fileStringBuffer", "read")); - permissions.add(new PropertyPermission("dataproviderthreadcount", "read")); - } - - /* - * Add permissions for your tests. - * @param permissions to be added. - */ - private void addPermissions(Permissions ps) { - Collections.list(ps.elements()).forEach(p -> permissions.add(p)); - } - - - /* - * Add permissions for your tests. - * @param permissions to be added. - */ - private void addPermissions(Permission[] ps) { - Arrays.stream(ps).forEach(p -> permissions.add(p)); - } - - /** - * Set all permissions. Caution: this should not called carefully unless - * it's really needed. - */ - private void setAllPermissions() { - permissions.add(new AllPermission()); - } - - /* - * Overloaded methods from the Policy class. - */ - @Override - public String toString() { - StringJoiner sj = new StringJoiner("\n", "policy: ", ""); - Enumeration perms = permissions.elements(); - while (perms.hasMoreElements()) { - sj.add(perms.nextElement().toString()); - } - return sj.toString(); - - } - - @Override - public PermissionCollection getPermissions(ProtectionDomain domain) { - return permissions; - } - - @Override - public PermissionCollection getPermissions(CodeSource codesource) { - return permissions; - } - - @Override - public boolean implies(ProtectionDomain domain, Permission perm) { - if (defaultPolicy.implies(domain, perm)) - return true; - - return permissions.implies(perm); - } -} --- old/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java 2016-07-18 00:52:59.353130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ - -package policy; - -import java.security.Policy; - -public class PolicyUtil { - - public static void changePolicy(String policyFile) { - System.setProperty("java.security.policy", policyFile); - Policy.getPolicy().refresh(); - } - -} --- old/test/javax/xml/jaxp/unittest/policy/common.policy 2016-07-18 00:52:59.643130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,27 +0,0 @@ -grant { - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; - - permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete"; - permission java.io.FilePermission ".", "read, write, delete"; - permission java.util.PropertyPermission "*", "read, write"; - - permission java.lang.RuntimePermission "setSecurityManager"; - permission java.lang.RuntimePermission "createSecurityManager"; - permission java.lang.RuntimePermission "createClassLoader"; - permission java.lang.RuntimePermission "setIO"; - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.security.SecurityPermission "getPolicy"; - - permission java.io.FilePermission "${test.src}/-", "read, write, delete"; - permission java.io.FilePermission "${user.dir}/-", "read, write, delete"; - permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete"; - - permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.bcel.internal.classfile"; - permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.bcel.internal.generic"; - permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.stream.writers"; - permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xerces.internal.impl"; - permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal"; - permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal.xsltc.trax"; - permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal.xslt"; -}; --- old/test/javax/xml/jaxp/unittest/transform/CR6551600.policy 2016-07-18 00:52:59.924130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,22 +0,0 @@ -grant { - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; - - permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete"; - permission java.io.FilePermission ".", "read, write, delete"; - permission java.util.PropertyPermission "*", "read, write"; - - permission java.lang.RuntimePermission "setSecurityManager"; - permission java.lang.RuntimePermission "createSecurityManager"; - permission java.lang.RuntimePermission "createClassLoader"; - permission java.lang.RuntimePermission "setIO"; - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.security.SecurityPermission "getPolicy"; - - permission java.io.FilePermission "${test.src}/-", "read, write, delete"; - permission java.io.FilePermission "${user.dir}/-", "read, write, delete"; - permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete"; - - permission java.io.FilePermission "//localhost/C$/xslt_unc_test.xml", "read, write, delete"; - -}; --- old/test/javax/xml/jaxp/unittest/validation/6773084.policy 2016-07-18 00:53:00.195130271 -0700 +++ /dev/null 2016-07-18 02:17:27.392000000 -0700 @@ -1,23 +0,0 @@ -grant { - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; - - permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete"; - permission java.io.FilePermission ".", "read, write, delete"; - permission java.util.PropertyPermission "*", "read, write"; - - permission java.lang.RuntimePermission "setSecurityManager"; - permission java.lang.RuntimePermission "createSecurityManager"; - permission java.lang.RuntimePermission "createClassLoader"; - permission java.lang.RuntimePermission "setIO"; - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.security.SecurityPermission "getPolicy"; - - permission java.io.FilePermission "${test.src}/-", "read, write, delete"; - permission java.io.FilePermission "${user.dir}/-", "read, write, delete"; - permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete"; - - - permission java.lang.RuntimePermission "modifyThread"; - -};