--- old/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java 2016-07-21 20:35:05.740027778 -0700 +++ new/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java 2016-07-21 20:35:05.626027778 -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