< prev index next >

test/javax/xml/jaxp/unittest/common/TransformationWarningsTest.java

Print this page

        

@@ -40,16 +40,17 @@
 
 /*
  * @test
  * @bug 8144593
  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @compile -XDignore.symbol.file TestSAXDriver.java
  * @run testng/othervm -DrunSecMngr=true common.TransformationWarningsTest
  * @run testng/othervm common.TransformationWarningsTest
  * @summary Check that warnings about unsupported properties from parsers
  * are suppressed during the transformation process.
  */
-@Listeners({jaxp.library.BasePolicy.class})
+@Listeners({jaxp.library.BasePolicy.class, jaxp.library.InternalAPIPolicy.class})
 public class TransformationWarningsTest extends WarningsTestBase {
 
     @BeforeClass
     public void setup() {
         //Set test SAX driver implementation.

@@ -78,11 +79,16 @@
     Transformer createTransformer() throws Exception {
         // Prepare sources for transormation
         Source xslsrc = new StreamSource(new StringReader(xsl));
 
         // Create factory and transformer
-        TransformerFactory tf = TransformerFactory.newInstance();
+        TransformerFactory tf;
+        // newTransformer() method doc states that different transformer
+        // factories can be used concurrently by different Threads.
+        synchronized (TransformerFactory.class) {
+            tf = TransformerFactory.newInstance();
+        }
         Transformer t = tf.newTransformer(xslsrc);
 
         // Set URI Resolver to return the newly constructed xml
         // stream source object from xml test string
         t.setURIResolver((String href, String base) -> new StreamSource(new StringReader(xml)));
< prev index next >