8175043: Multiple jaxp tests failing across platforms
authorfyuan
Thu, 16 Feb 2017 21:39:21 +0800
changeset 43848 df00e91e8bfe
parent 43847 4cbf6763554c
child 43849 a6f26574de4e
8175043: Multiple jaxp tests failing across platforms Reviewed-by: weijun, joehw
jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java
jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java
jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java
jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java
jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java
jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java
jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java
jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java
jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java
jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java
jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java
jaxp/test/javax/xml/jaxp/unittest/transform/util/TransformerUtil.java
jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java
jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java
--- a/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java	Thu Feb 16 21:39:21 2017 +0800
@@ -22,6 +22,7 @@
  */
 package org.w3c.dom.ptests;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
 import static org.testng.Assert.assertEquals;
@@ -157,7 +158,7 @@
         Element element = (Element) document.getElementsByTagName("sender").item(0);
         parentElement.insertBefore(createTestDocumentFragment(document), element);
 
-        String outputfile = "InsertBefore.out";
+        String outputfile = USER_DIR + "InsertBefore.out";
         String goldfile = GOLDEN_DIR + "InsertBeforeGF.out";
         tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
         assertTrue(compareWithGold(goldfile, outputfile));
@@ -175,7 +176,7 @@
         Element element = (Element) document.getElementsByTagName("sender").item(0);
         parentElement.replaceChild(createTestDocumentFragment(document), element);
 
-        String outputfile = "ReplaceChild3.out";
+        String outputfile = USER_DIR + "ReplaceChild3.out";
         String goldfile = GOLDEN_DIR + "ReplaceChild3GF.out";
         tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
         assertTrue(compareWithGold(goldfile, outputfile));
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java	Thu Feb 16 21:39:21 2017 +0800
@@ -22,6 +22,7 @@
  */
 package test.astro;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.filenameToURL;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
@@ -130,7 +131,7 @@
         impl = (DOMImplementationLS) db.getDOMImplementation();
         LSSerializer domSerializer = impl.createLSSerializer();
         MyDOMOutput mydomoutput = new MyDOMOutput();
-        try (OutputStream os = new FileOutputStream("test.out")) {
+        try (OutputStream os = new FileOutputStream(USER_DIR + "test.out")) {
             mydomoutput.setByteStream(os);
             mydomoutput.setEncoding("UTF-8");
             assertTrue(domSerializer.write(doc, mydomoutput));
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,7 @@
 
 package parsers;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
 
 import java.io.File;
@@ -61,7 +62,7 @@
             return;
         }
         try {
-            File dir = new File(ALPHA);
+            File dir = new File(USER_DIR + ALPHA);
             dir.delete();
             dir.mkdir();
             File main = new File(dir, "main.xml");
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,7 @@
 
 package sax;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.getSystemProperty;
 import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
 
@@ -69,7 +70,7 @@
     @Test
     public void testParse() {
         File src = new File(getClass().getResource(xml).getFile());
-        File dst = new File(xml1);
+        File dst = new File(USER_DIR + xml1);
         try {
             copyFile(src, dst);
             SAXParserFactory spf = SAXParserFactory.newInstance();
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,8 @@
 
 package stream;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.InputStream;
@@ -67,15 +69,15 @@
     }
 
     public class MyRunnable implements Runnable {
-        final int no;
+        final String no;
 
         MyRunnable(int no) {
-            this.no = no;
+            this.no = String.valueOf(no);
         }
 
         public void run() {
             try {
-                FileOutputStream fos = new FileOutputStream("" + no);
+                FileOutputStream fos = new FileOutputStream(USER_DIR + no);
                 XMLStreamWriter w = getWriter(fos);
                 // System.out.println("Writer="+w+" Thread="+Thread.currentThread());
                 w.writeStartDocument();
@@ -89,7 +91,7 @@
                 w.close();
                 fos.close();
 
-                FileInputStream fis = new FileInputStream("" + no);
+                FileInputStream fis = new FileInputStream(USER_DIR + no);
                 XMLStreamReader r = getReader(fis);
                 while (r.hasNext()) {
                     r.next();
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,8 @@
 
 package stream.XMLEventWriterTest;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -58,7 +60,7 @@
     private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
 
     private static final String INPUT_FILE = "W2JDLR4002TestService.wsdl.data";
-    private static final String OUTPUT_FILE = "Encoded.wsdl";
+    private static final String OUTPUT_FILE = USER_DIR + "Encoded.wsdl";
 
     /**
      * Unit test for writing namespaces when namespaceURI == null.
@@ -126,7 +128,7 @@
 
         try {
             InputStream in = getClass().getResourceAsStream("ReaderToWriterTest.wsdl");
-            OutputStream out = new FileOutputStream("ReaderToWriterTest-out.xml");
+            OutputStream out = new FileOutputStream(USER_DIR + "ReaderToWriterTest-out.xml");
 
             XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(in);
             XMLEventWriter writer = XML_OUTPUT_FACTORY.createXMLEventWriter(out, "UTF-8");
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,8 @@
 
 package stream.XMLStreamWriterTest;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -84,7 +86,7 @@
         System.out.println("Test StreamWriter with out any namespace functionality");
 
         try {
-            String outputFile = files[0] + ".out";
+            String outputFile = USER_DIR + files[0] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -98,7 +100,7 @@
             xtw.flush();
             xtw.close();
 
-            Assert.assertTrue(checkResults(files[0] + ".out", files[0] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[0] + ".org"));
 
         } catch (Exception ex) {
             Assert.fail("testOne Failed " + ex);
@@ -113,7 +115,7 @@
         System.out.println("Test StreamWriter's Namespace Context");
 
         try {
-            String outputFile = files[1] + ".out";
+            String outputFile = USER_DIR + files[1] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(System.out);
@@ -157,7 +159,7 @@
         System.out.println("Test StreamWriter for proper element sequence.");
 
         try {
-            String outputFile = files[2] + ".out";
+            String outputFile = USER_DIR + files[2] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -172,7 +174,7 @@
             xtw.flush();
             xtw.close();
 
-            Assert.assertTrue(checkResults(files[2] + ".out", files[2] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[2] + ".org"));
 
         } catch (Exception ex) {
             Assert.fail("testThree Failed " + ex);
@@ -188,7 +190,7 @@
 
         try {
 
-            String outputFile = files[3] + ".out";
+            String outputFile = USER_DIR + files[3] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -205,7 +207,7 @@
             xtw.flush();
             xtw.close();
 
-            Assert.assertTrue(checkResults(files[3] + ".out", files[3] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[3] + ".org"));
 
         } catch (Exception ex) {
             Assert.fail("testFour Failed " + ex);
@@ -221,7 +223,7 @@
 
         try {
 
-            String outputFile = files[4] + ".out";
+            String outputFile = USER_DIR + files[4] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(System.out);
@@ -265,7 +267,7 @@
             xtw.writeEndDocument();
             xtw.flush();
             xtw.close();
-            Assert.assertTrue(checkResults(files[4] + ".out", files[4] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[4] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             Assert.fail("testFive Failed " + ex);
@@ -281,7 +283,7 @@
 
         try {
 
-            String outputFile = files[5] + ".out";
+            String outputFile = USER_DIR + files[5] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(System.out);
@@ -325,7 +327,7 @@
             xtw.writeEndDocument();
             xtw.flush();
             xtw.close();
-            Assert.assertTrue(checkResults(files[5] + ".out", files[5] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[5] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             Assert.fail("testSix Failed " + ex);
@@ -341,7 +343,7 @@
 
         try {
 
-            String outputFile = files[6] + ".out";
+            String outputFile = USER_DIR + files[6] + ".out";
             System.out.println("Writing output to " + outputFile);
 
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -374,7 +376,7 @@
             xtw.writeEndDocument();
             xtw.flush();
             xtw.close();
-            Assert.assertTrue(checkResults(files[6] + ".out", files[6] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[6] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             Assert.fail("testSeven Failed " + ex);
@@ -390,7 +392,7 @@
 
         try {
 
-            String outputFile = files[7] + ".out";
+            String outputFile = USER_DIR + files[7] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -424,7 +426,7 @@
             xtw.flush();
             xtw.close();
             // check against testSeven.xml.org
-            Assert.assertTrue(checkResults(files[7] + ".out", files[7] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[7] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             ex.printStackTrace();
@@ -442,7 +444,7 @@
 
         try {
 
-            String outputFile = files[8] + ".out";
+            String outputFile = USER_DIR + files[8] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -476,7 +478,7 @@
             xtw.flush();
             xtw.close();
             // check against testSeven.xml.org
-            Assert.assertTrue(checkResults(files[8] + ".out", files[7] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[7] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             Assert.fail("testNine Failed " + ex);
@@ -491,7 +493,7 @@
         System.out.println("Test StreamWriter supplied with no namespace information and" + "isRepairingNamespace is set to true.");
         try {
 
-            String outputFile = files[9] + ".out";
+            String outputFile = USER_DIR + files[9] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -542,7 +544,7 @@
         System.out.println("Test StreamWriter supplied with  namespace information passed through startElement and" + "isRepairingNamespace is set to true.");
         try {
 
-            String outputFile = files[10] + ".out";
+            String outputFile = USER_DIR + files[10] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -576,7 +578,7 @@
             xtw.flush();
             xtw.close();
             // check against testSeven.xml.org
-            Assert.assertTrue(checkResults(files[10] + ".out", files[7] + ".org"));
+            Assert.assertTrue(checkResults(outputFile, files[7] + ".org"));
             System.out.println("Done");
         } catch (Exception ex) {
             Assert.fail("testEleven Failed " + ex);
@@ -592,7 +594,7 @@
 
         try {
 
-            String outputFile = files[11] + ".out";
+            String outputFile = USER_DIR + files[11] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -643,7 +645,7 @@
 
         try {
 
-            String outputFile = files[12] + ".out";
+            String outputFile = USER_DIR + files[12] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
@@ -695,7 +697,7 @@
 
         try {
 
-            String outputFile = files[14] + ".out";
+            String outputFile = USER_DIR + files[14] + ".out";
             System.out.println("Writing output to " + outputFile);
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
             xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,8 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -55,7 +57,7 @@
     // save dtd file to current working directory to avoid writing into source repository
     public void copyDTDtoWorkDir() throws IOException {
         try (FileInputStream dtdres = new FileInputStream(getClass().getResource("Bug4693341.dtd").getPath());
-             FileOutputStream dtdwork = new FileOutputStream("Bug4693341.dtd");) {
+             FileOutputStream dtdwork = new FileOutputStream(USER_DIR + "Bug4693341.dtd");) {
             int n;
             byte[] buffer = new byte[1024];
             while((n = dtdres.read(buffer)) > -1) {
@@ -71,7 +73,7 @@
 
             copyDTDtoWorkDir();
 
-            File outf = new File("Bug4693341.out");
+            File outf = new File(USER_DIR + "Bug4693341.out");
             StreamResult result = new StreamResult(new FileOutputStream(outf));
 
             String in = getClass().getResource("Bug4693341.xml").getPath();
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,8 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.File;
 
 import javax.xml.transform.Source;
@@ -58,7 +60,7 @@
 
     private final String XML_FILE = "catalog.xml";
     private final String XML10_FILE = "catalog_10.xml"; // 1.0 version document
-    private final String TEMP_FILE = "tmp.xml";
+    private final String TEMP_FILE = USER_DIR + "tmp.xml";
     private final String EXPECTED_VERSION = "1.1";
     static private Transformer idTransform = null;
 
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,7 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
 
 import java.io.File;
@@ -52,7 +53,7 @@
     @Test
     public final void test() {
         try {
-            File test = new File("bug6216226.txt");
+            File test = new File(USER_DIR + "bug6216226.txt");
             TransformerFactory tf = TransformerFactory.newInstance();
             Transformer xformer = tf.newTransformer();
             StringReader st = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?><doc></doc>");
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,8 @@
 
 package transform;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.FileOutputStream;
 
 import javax.xml.transform.Result;
@@ -65,7 +67,7 @@
             Transformer xformer = template.newTransformer();
             // Prepare the input and output files
             Source source = new StreamSource(getClass().getResourceAsStream(inFilename));
-            Result result = new StreamResult(new FileOutputStream(outFilename));
+            Result result = new StreamResult(new FileOutputStream(USER_DIR + outFilename));
             // Apply the xsl file to the source file and write the result to the
             // output file
             xformer.transform(source, result);
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,7 @@
 
 package transform;
 
+import java.io.FilePermission;
 import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
@@ -46,6 +47,7 @@
 import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
 import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
 import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
 import static jaxp.library.JAXPTestUtilities.getSystemProperty;
 
 /*
@@ -77,7 +79,9 @@
         Transformer t = tf.newTransformer(new StreamSource(new StringReader(xsl)));
 
         //Transform the xml
-        t.transform(new StreamSource(new StringReader(xml)), new StreamResult(new StringWriter()));
+        tryRunWithTmpPermission(
+                () -> t.transform(new StreamSource(new StringReader(xml)), new StreamResult(new StringWriter())),
+                new FilePermission(output, "write"), new FilePermission(redirect, "write"));
 
         // Verifies that the output is redirected successfully
         String userDir = getSystemProperty("user.dir");
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/TransformerUtil.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/TransformerUtil.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,8 @@
 
 package transform.util;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.InputStream;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -34,7 +36,7 @@
 
     protected String type;
 
-    protected final String TEMP_FILE = "tmp.xml";
+    protected final String TEMP_FILE = USER_DIR + "tmp.xml";
 
     public abstract Source prepareSource(InputStream is) throws Exception;
 
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,8 @@
 
 package validation;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
 import java.io.File;
 import java.io.FileWriter;
 
@@ -122,7 +124,7 @@
             Validator schemaValidator = schemaGrammar.newValidator();
 
             Source staxSrc = new StAXSource(staxReader);
-            File resultFile = new File("gMonths.result.xml");
+            File resultFile = new File(USER_DIR + "gMonths.result.xml");
             if (resultFile.exists()) {
                 resultFile.delete();
             }
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java	Thu Feb 16 13:19:17 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java	Thu Feb 16 21:39:21 2017 +0800
@@ -23,6 +23,7 @@
 
 package validation;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
 
 import java.io.File;
@@ -61,7 +62,7 @@
 
         File resultFile = null;
         try {
-            resultFile = new File("stax.result");
+            resultFile = new File(USER_DIR + "stax.result");
             if (resultFile.exists()) {
                 resultFile.delete();
             }
@@ -88,7 +89,7 @@
 
         File resultFile = null;
         try {
-            resultFile = new File("stax.result");
+            resultFile = new File(USER_DIR + "stax.result");
             if (resultFile.exists()) {
                 resultFile.delete();
             }
@@ -117,7 +118,7 @@
         // test valid gMonths
         File resultFile = null;
         try {
-            resultFile = new File("gMonths.result.xml");
+            resultFile = new File(USER_DIR + "gMonths.result.xml");
             if (resultFile.exists()) {
                 resultFile.delete();
             }
@@ -144,7 +145,7 @@
         // test invalid gMonths
         File invalidResultFile = null;
         try {
-            invalidResultFile = new File("gMonths-invalid.result.xml");
+            invalidResultFile = new File(USER_DIR + "gMonths-invalid.result.xml");
             if (invalidResultFile.exists()) {
                 invalidResultFile.delete();
             }