changeset 686:e7736286abe1

8051563: Update JAXP functional tests Reviewed-by: lancea, joehw Contributed-by: tristan.yan@oracle.com
author joehw
date Thu, 15 Jan 2015 19:10:56 -0800
parents 74eaf7ad9865
children e391de88e69b
files test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory01.java test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory02.java test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/TestUtils.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest01.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest01.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest001.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest002.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest003.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest004.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest005.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest006.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest008.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest009.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest010.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest011.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest012.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest013.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest01.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/MyAttrCHandler.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/MyNSContentHandler.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest01.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java test/javax/xml/jaxp/functional/test/auctionportal/MyDOMErrorHandler.java test/javax/xml/jaxp/functional/test/auctionportal/MyDOMOutput.java test/javax/xml/jaxp/functional/test/auctionportal/MyErrorHandler.java test/javax/xml/jaxp/functional/test/auctionportal/UserController.java test/javax/xml/jaxp/functional/test/auctionportal/XInclHandler.java test/javax/xml/jaxp/libs/javax/xml/parsers/ptests/MyCHandler.java test/javax/xml/jaxp/libs/javax/xml/parsers/ptests/MyErrorHandler.java test/javax/xml/jaxp/libs/javax/xml/parsers/ptests/ParserTestConst.java test/javax/xml/jaxp/libs/javax/xml/transform/ptests/MyContentHandler.java test/javax/xml/jaxp/libs/javax/xml/transform/ptests/TransformerTestConst.java test/javax/xml/jaxp/libs/javax/xml/xpath/ptests/XPathTestConst.java test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java test/javax/xml/jaxp/libs/jaxp/library/JAXPFileReadOnlyBaseTest.java test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java test/javax/xml/jaxp/libs/org/xml/sax/ptests/MyAttrCHandler.java test/javax/xml/jaxp/libs/org/xml/sax/ptests/MyNSContentHandler.java test/javax/xml/jaxp/libs/org/xml/sax/ptests/SAXTestConst.java test/javax/xml/jaxp/libs/test/auctionportal/HiBidConstants.java test/javax/xml/jaxp/libs/test/auctionportal/MyDOMErrorHandler.java test/javax/xml/jaxp/libs/test/auctionportal/MyDOMOutput.java test/javax/xml/jaxp/libs/test/auctionportal/MyErrorHandler.java test/javax/xml/jaxp/libs/test/auctionportal/XInclHandler.java
diffstat 89 files changed, 5755 insertions(+), 6696 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,64 +23,59 @@
 
 package javax.xml.parsers.ptests;
 
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
-
 import java.io.File;
-import java.io.IOException;
-
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
+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.TransformerFactoryConfigurationError;
 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.Test;
 import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
 
 /**
  * This tests DocumentBuilderFactory for namespace processing and no-namespace
  * processing.
  */
-public class DBFNamespaceTest {
+public class DBFNamespaceTest extends JAXPFileBaseTest {
 
     /**
      * Provide input for the cases that supporting namespace or not.
+     * @return a two-dimensional array contains factory, output file name and
+     *         golden validate file name.
      */
     @DataProvider(name = "input-provider")
     public Object[][] getInput() {
         DocumentBuilderFactory dbf1 = DocumentBuilderFactory.newInstance();
-        String outputfile1 = USER_DIR + FILE_SEP + "dbfnstest01.out";
-        String goldfile1 = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfnstest01GF.out";
+        String outputfile1 = USER_DIR + "dbfnstest01.out";
+        String goldfile1 = GOLDEN_DIR + "dbfnstest01GF.out";
 
         DocumentBuilderFactory dbf2 = DocumentBuilderFactory.newInstance();
         dbf2.setNamespaceAware(true);
-        String outputfile2 = USER_DIR + FILE_SEP + "dbfnstest02.out";
-        String goldfile2 = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfnstest02GF.out";
+        String outputfile2 = USER_DIR + "dbfnstest02.out";
+        String goldfile2 = GOLDEN_DIR + "dbfnstest02GF.out";
         return new Object[][] { { dbf1, outputfile1, goldfile1 }, { dbf2, outputfile2, goldfile2 } };
     }
 
     /**
      * Test to parse and transform a document without supporting namespace and
      * with supporting namespace.
+     * @param dbf a Document Builder factory for creating document object.
+     * @param outputfile output file name.
+     * @param goldfile golden validate file name.
+     * @throws Exception If any errors occur.
      */
     @Test(dataProvider = "input-provider")
-    public void testNamespaceTest(DocumentBuilderFactory dbf, String outputfile, String goldfile) {
-        try {
-            Document doc = dbf.newDocumentBuilder().parse(new File(TestUtils.XML_DIR, "namespace1.xml"));
-            dummyTransform(doc, outputfile);
-            assertTrue(compareWithGold(goldfile, outputfile));
-        } catch (SAXException | IOException | ParserConfigurationException | TransformerFactoryConfigurationError | TransformerException e) {
-            failUnexpected(e);
-        }
+    public void testNamespaceTest(DocumentBuilderFactory dbf, String outputfile,
+            String goldfile) throws Exception {
+        Document doc = dbf.newDocumentBuilder().parse(new File(XML_DIR, "namespace1.xml"));
+        dummyTransform(doc, outputfile);
+        assertTrue(compareWithGold(goldfile, outputfile));
     }
 
     /**
@@ -89,16 +84,14 @@
      * not chosen, namespaceURI in callbacks should be an empty string otherwise
      * it should be namespaceURI.
      *
-     * @throws TransformerFactoryConfigurationError
-     * @throws TransformerException
-     * @throws IOException
+     * @throws Exception If any errors occur.
      */
-    private void dummyTransform(Document document, String fileName) throws TransformerFactoryConfigurationError, TransformerException, IOException {
+    private void dummyTransform(Document document, String fileName)
+            throws Exception {
         DOMSource domSource = new DOMSource(document);
-        Transformer transformer = TransformerFactory.newInstance().newTransformer();
-        File file = new File(fileName);
-        System.out.println("The fileName is " + file.getAbsolutePath());
-        transformer.transform(domSource, new SAXResult(MyCHandler.newInstance(file)));
+        try(MyCHandler chandler = MyCHandler.newInstance(new File(fileName))) {
+            TransformerFactory.newInstance().newTransformer().
+                transform(domSource, new SAXResult(chandler));
+        }
     }
-
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory01.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,451 +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 javax.xml.parsers.ptests;
-
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-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 java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * This checks the methods of DocumentBuilderFactoryImpl
- */
-public class DocumentBuilderFactory01 {
-    /**
-     * Testcase to test the default functionality of schema support method.
-     */
-    @Test
-    public void testCheckSchemaSupport1() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            dbf.setNamespaceAware(true);
-            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "test.xml"));
-            assertFalse(eh.errorOccured);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the default functionality of schema support method. In
-     * this case the schema source property is set.
-     */
-    @Test
-    public void testCheckSchemaSupport2() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            dbf.setNamespaceAware(true);
-            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
-            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", new InputSource(new FileInputStream(
-                    new File(TestUtils.XML_DIR, "test.xsd"))));
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "test1.xml"));
-            assertFalse(eh.errorOccured);
-        } catch (IllegalArgumentException | ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * Testcase to test the default functionality of schema support method. In
-     * this case the schema source property is set.
-     */
-    @Test
-    public void testCheckSchemaSupport3() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            spf.setValidating(true);
-            spf.setNamespaceAware(true);
-            SAXParser sp = spf.newSAXParser();
-            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
-            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",
-                    new InputSource(new FileInputStream(new File(TestUtils.XML_DIR, "test.xsd"))));
-            DefaultHandler dh = new DefaultHandler();
-            sp.parse(new File(TestUtils.XML_DIR, "test1.xml"), dh);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the default functionality of newInstance method. To test
-     * the isCoalescing method and setCoalescing This checks to see if the CDATA
-     * and text nodes got combined In that case it will print "<xml>This
-     * is not parsed</xml> yet".
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory02() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setCoalescing(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory01.xml"));
-            Element e = (Element) doc.getElementsByTagName("html").item(0);
-            NodeList nl = e.getChildNodes();
-            assertEquals(nl.item(0).getNodeValue().trim(), "<xml>This is not parsed</xml> yet");
-        } catch (IOException | SAXException | ParserConfigurationException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the isIgnoringComments. By default it is false.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory03() {
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        assertFalse(dbf.isIgnoringComments());
-    }
-
-    /**
-     * Testcase to test the isValidating. By default it is false, set it to true
-     * and then use a document which is not valid. It should throw a warning or
-     * an error at least. The test passes in case retval 0 is set in the error
-     * method .
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory04() {
-        try {
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory05.xml"));
-            assertTrue(eh.errorOccured);
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the setValidating. By default it is false, use a
-     * document which is not valid. It should not throw a warning or an error.
-     * The test passes in case the retval equals 1 .
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory16() {
-        try {
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory05.xml"));
-            assertFalse(eh.errorOccured);
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * Testcase to test the setValidating. By default it is false, use a
-     * document which is valid. It should not throw a warning or an error. The
-     * test passes in case the retval equals 1.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory17() {
-        try {
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory04.xml"));
-            assertFalse(eh.errorOccured);
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * To test the isExpandEntityReferences. By default it is true.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory05() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
-            Element e = (Element) doc.getElementsByTagName("title").item(0);
-            NodeList nl = e.getChildNodes();
-            assertTrue(dbf.isExpandEntityReferences());
-            assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the default functionality of setValidating method. The
-     * xml file has a DTD which has namespaces defined. The parser takes care to
-     * check if the namespaces using elements and defined attributes are there
-     * or not.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory06() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory04.xml"));
-            assertTrue(doc instanceof Document);
-            assertFalse(eh.errorOccured);
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * Testcase to test the setExpandEntityReferences.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory07() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setExpandEntityReferences(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
-            Element e = (Element) doc.getElementsByTagName("title").item(0);
-            NodeList nl = e.getChildNodes();
-            assertTrue(dbf.isExpandEntityReferences());
-            assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the setExpandEntityReferences.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory08() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setExpandEntityReferences(false);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
-            Element e = (Element) doc.getElementsByTagName("title").item(0);
-            NodeList nl = e.getChildNodes();
-            assertNull(nl.item(0).getNodeValue());
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the setIgnoringComments. By default it is set to false.
-     * explicitly setting it to false, it recognizes the comment which is in
-     * Element Node Hence the Element's child node is not null.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory09() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setIgnoringComments(false);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")));
-            Element e = (Element) doc.getElementsByTagName("body").item(0);
-            NodeList nl = e.getChildNodes();
-            assertNotNull(nl.item(0).getNodeValue());
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * This tests for the parse(InputSource).
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory10() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new InputSource(new BufferedReader(new FileReader(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")))));
-            assertTrue(doc instanceof Document);
-        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * This tests for the parse InputStream with SystemID as a second parameter.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory11() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "dbf10import.xsl")), new File(TestUtils.XML_DIR).toURI()
-                    .toASCIIString());
-            assertTrue(doc instanceof Document);
-        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * This tests for the parse InputStream with empty SystemID as a second
-     * parameter.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory12() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "dbf10import.xsl")), " ");
-            assertTrue(doc instanceof Document);
-        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * This tests for the parse(uri).
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory13() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new File(TestUtils.XML_DIR + FILE_SEP + "dbf10import.xsl").toURI().toASCIIString());
-            assertTrue(doc instanceof Document);
-        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * This tests for the parse (uri) with empty string as parameter should
-     * throw Sax Exception.
-     *
-     * @throws SAXException
-     *             If any parse errors occur.
-     */
-    @Test(expectedExceptions = SAXException.class)
-    public void testCheckDocumentBuilderFactory14() throws SAXException {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            docBuilder.parse("");
-        } catch (ParserConfigurationException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * This tests for the parse (uri) with null uri as parameter should throw
-     * IllegalArgumentException.
-     *
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testCheckDocumentBuilderFactory15() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            String uri = null;
-            docBuilder.parse(uri);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the setIgnoringComments. By default it is set to false,
-     * setting this to true, It does not recognize the comment, Here the
-     * nodelist has a length 0 because the ignoring comments is true.
-     */
-    @Test
-    public void testCheckIgnoringComments() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setIgnoringComments(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory08.xml")));
-            Element e = (Element) doc.getElementsByTagName("body").item(0);
-            NodeList nl = e.getChildNodes();
-            assertEquals(nl.getLength(), 0);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * Testcase to test the default behaviour of setIgnoringComments. By default
-     * it is set to false, this is similar to case 9 but not setIgnoringComments
-     * explicitly, it does not recognize the comment.
-     */
-    @Test
-    public void testCheckIgnoringComments1() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")));
-            Element e = (Element) doc.getElementsByTagName("body").item(0);
-            NodeList nl = e.getChildNodes();
-            assertFalse(dbf.isIgnoringComments());
-            assertNotNull(nl.item(0).getNodeValue());
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory02.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +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 javax.xml.parsers.ptests;
-
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXResult;
-
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * This tests the setIgnoringElementWhitespace and setIgnoringComments of
- * DocumentBuilderFactory
- */
-public class DocumentBuilderFactory02 {
-
-    /**
-     * This testcase tests for the isIgnoringElementContentWhitespace and the
-     * setIgnoringElementContentWhitespace. The xml file has all kinds of
-     * whitespace,tab and newline characters, it uses the MyNSContentHandler
-     * which does not invoke the characters callback when this
-     * setIgnoringElementContentWhitespace is set to true.
-     */
-    @Test
-    public void testCheckElementContentWhitespace() {
-        try {
-            String goldFile = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfactory02GF.out";
-            String outputFile = USER_DIR + FILE_SEP + "dbfactory02.out";
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            assertFalse(dbf.isIgnoringElementContentWhitespace());
-            dbf.setIgnoringElementContentWhitespace(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory06.xml"));
-            assertFalse(eh.errorOccured);
-            DOMSource domSource = new DOMSource(doc);
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            Transformer transformer = tfactory.newTransformer();
-            SAXResult saxResult = new SAXResult();
-            saxResult.setHandler(MyCHandler.newInstance(new File(outputFile)));
-            transformer.transform(domSource, saxResult);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (ParserConfigurationException | SAXException | IOException | TransformerException e) {
-            failUnexpected(e);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -0,0 +1,462 @@
+/*
+ * Copyright (c) 1999, 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 javax.xml.parsers.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilePermission;
+import java.io.FileReader;
+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;
+import javax.xml.parsers.SAXParserFactory;
+import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXResult;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * This checks the methods of DocumentBuilderFactoryImpl.
+ */
+public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
+    /**
+     * Test the default functionality of schema support method.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckSchemaSupport1() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(true);
+        dbf.setNamespaceAware(true);
+        dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+                W3C_XML_SCHEMA_NS_URI);
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.setErrorHandler(eh);
+        db.parse(new File(XML_DIR, "test.xml"));
+        assertFalse(eh.isErrorOccured());
+    }
+
+    /**
+     * Test the default functionality of schema support method. In
+     * this case the schema source property is set.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckSchemaSupport2() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "test.xsd"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setValidating(true);
+            dbf.setNamespaceAware(true);
+            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+                    W3C_XML_SCHEMA_NS_URI);
+            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",
+                    new InputSource(fis));
+            MyErrorHandler eh = MyErrorHandler.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            db.setErrorHandler(eh);
+            db.parse(new File(XML_DIR, "test1.xml"));
+            assertFalse(eh.isErrorOccured());
+        }
+    }
+
+    /**
+     * Test the default functionality of schema support method. In
+     * this case the schema source property is set.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckSchemaSupport3() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "test.xsd"))) {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setValidating(true);
+            spf.setNamespaceAware(true);
+            SAXParser sp = spf.newSAXParser();
+            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+                    W3C_XML_SCHEMA_NS_URI);
+            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",
+                    new InputSource(fis));
+            DefaultHandler dh = new DefaultHandler();
+            // Not expect any unrecoverable error here.
+            sp.parse(new File(XML_DIR, "test1.xml"), dh);
+        }
+    }
+
+    /**
+     * Test the default functionality of newInstance method. To test
+     * the isCoalescing method and setCoalescing This checks to see if the CDATA
+     * and text nodes got combined In that case it will print "&lt;xml&gt;This
+     * is not parsed&lt;/xml&gt; yet".
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory02() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setCoalescing(true);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        Document doc = docBuilder.parse(new File(XML_DIR, "DocumentBuilderFactory01.xml"));
+        Element e = (Element) doc.getElementsByTagName("html").item(0);
+        NodeList nl = e.getChildNodes();
+        assertEquals(nl.getLength(), 1);
+    }
+
+    /**
+     * Test the isIgnoringComments. By default it is false.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory03() {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        assertFalse(dbf.isIgnoringComments());
+    }
+
+    /**
+     * Test the isValidating. By default it is false, set it to true and then
+     * use a document which is not valid. It should throw a warning or
+     * an error at least. The test passes in case retval 0 is set in the error
+     * method .
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory04() throws Exception {
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.setErrorHandler(eh);
+        db.parse(new File(XML_DIR, "DocumentBuilderFactory05.xml"));
+        assertTrue(eh.isErrorOccured());
+    }
+
+    /**
+     * Test the setValidating. By default it is false, use a
+     * document which is not valid. It should not throw a warning or an error.
+     * The test passes in case the return value equals 1.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory16() throws Exception {
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.setErrorHandler(eh);
+        db.parse(new File(XML_DIR, "DocumentBuilderFactory05.xml"));
+        assertFalse(eh.isErrorOccured());
+    }
+
+    /**
+     * Test the setValidating. By default it is false, use a
+     * document which is valid. It should not throw a warning or an error. The
+     * test passes in case the return value equals 1.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory17() throws Exception {
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.setErrorHandler(eh);
+        db.parse(new File(XML_DIR, "DocumentBuilderFactory04.xml"));
+        assertFalse(eh.isErrorOccured());
+    }
+
+    /**
+     * Test the isExpandEntityReferences. By default it is true.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory05() throws Exception {
+        try(FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory02.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("title").item(0);
+            NodeList nl = e.getChildNodes();
+            assertTrue(dbf.isExpandEntityReferences());
+            assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
+        }
+    }
+
+    /**
+     * Test the default functionality of setValidating method. The
+     * XML file has a DTD which has namespaces defined. The parser takes care to
+     * check if the namespaces using elements and defined attributes are there
+     * or not.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory06() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        db.setErrorHandler(eh);
+        Document doc = db.parse(new File(XML_DIR, "DocumentBuilderFactory04.xml"));
+        assertTrue(doc instanceof Document);
+        assertFalse(eh.isErrorOccured());
+    }
+
+    /**
+     * Test the setExpandEntityReferences.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory07() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory02.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setExpandEntityReferences(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("title").item(0);
+            NodeList nl = e.getChildNodes();
+            assertTrue(dbf.isExpandEntityReferences());
+            assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
+        }
+    }
+
+    /**
+     * Test the setExpandEntityReferences.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory08() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory02.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setExpandEntityReferences(false);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("title").item(0);
+            NodeList nl = e.getChildNodes();
+            assertNull(nl.item(0).getNodeValue());
+        }
+    }
+
+    /**
+     * Test the setIgnoringComments. By default it is set to false.
+     * explicitly setting it to false, it recognizes the comment which is in
+     * Element Node Hence the Element's child node is not null.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory09() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory07.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setIgnoringComments(false);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("body").item(0);
+            NodeList nl = e.getChildNodes();
+            assertNotNull(nl.item(0).getNodeValue());
+        }
+    }
+
+    /**
+     * This tests for the parse(InputSource).
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory10() throws Exception {
+        try (BufferedReader br = new BufferedReader(new FileReader(new File(
+                XML_DIR, "DocumentBuilderFactory07.xml")))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new InputSource(br));
+            assertNotNull(doc);
+        }
+    }
+
+    /**
+     * This tests for the parse InputStream with SystemID as a second parameter.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory11() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "dbf10import.xsl"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis, new File(XML_DIR).toURI()
+                    .toASCIIString());
+            assertNotNull(doc);
+        }
+    }
+
+    /**
+     * This tests for the parse InputStream with empty SystemID as a second
+     * parameter.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory12() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "dbf10import.xsl"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis, " ");
+            assertNotNull(doc);
+        }
+    }
+
+    /**
+     * This tests for the parse(uri).
+     * @throws Exception If any errors occur.
+     */
+    @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")
+                .toURI().toASCIIString());
+        assertNotNull(doc);
+    }
+
+    /**
+     * This tests for the parse(uri) with empty string as parameter should
+     * throw Sax Exception.
+     * @throws Exception If any errors occur.
+     */
+    @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("");
+    }
+
+    /**
+     * This tests for the parse (uri) with null uri as parameter should throw
+     * IllegalArgumentException.
+     * @throws Exception If any errors occur.
+     *
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testCheckDocumentBuilderFactory15() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        String uri = null;
+        docBuilder.parse(uri);
+    }
+
+    /**
+     * Test the setIgnoringComments. By default it is set to false,
+     * setting this to true, It does not recognize the comment, Here the
+     * nodelist has a length 0 because the ignoring comments is true.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckIgnoringComments() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory08.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setIgnoringComments(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("body").item(0);
+            NodeList nl = e.getChildNodes();
+            assertEquals(nl.getLength(), 0);
+        }
+    }
+
+    /**
+     * Test the default behaviour of setIgnoringComments. By default
+     * it is set to false, this is similar to case 9 but not setIgnoringComments
+     * explicitly, it does not recognize the comment.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckIgnoringComments1() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory07.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("body").item(0);
+            NodeList nl = e.getChildNodes();
+            assertFalse(dbf.isIgnoringComments());
+            assertNotNull(nl.item(0).getNodeValue());
+        }
+    }
+
+    /**
+     * Test for the isIgnoringElementContentWhitespace and the
+     * setIgnoringElementContentWhitespace. The xml file has all kinds of
+     * whitespace,tab and newline characters, it uses the MyNSContentHandler
+     * which does not invoke the characters callback when this
+     * setIgnoringElementContentWhitespace is set to true.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckElementContentWhitespace() throws Exception {
+        String goldFile = GOLDEN_DIR + "dbfactory02GF.out";
+        String outputFile = USER_DIR + "dbfactory02.out";
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(true);
+        assertFalse(dbf.isIgnoringElementContentWhitespace());
+        dbf.setIgnoringElementContentWhitespace(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.setErrorHandler(eh);
+        Document doc = db.parse(new File(XML_DIR, "DocumentBuilderFactory06.xml"));
+        assertFalse(eh.isErrorOccured());
+        DOMSource domSource = new DOMSource(doc);
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        Transformer transformer = tfactory.newTransformer();
+        SAXResult saxResult = new SAXResult();
+        try(MyCHandler handler = MyCHandler.newInstance(new File(outputFile))) {
+            saxResult.setHandler(handler);
+            transformer.transform(domSource, saxResult);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+}
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -24,33 +24,32 @@
 package javax.xml.parsers.ptests;
 
 import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertFalse;
-
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.IOException;
-
+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.Test;
-import org.w3c.dom.Document;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * This checks for the methods of DocumentBuilder
  */
-public class DocumentBuilderImpl01 implements EntityResolver {
-
+public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest
+            implements EntityResolver {
     /**
      * Provide DocumentBuilder.
      *
-     * @throws ParserConfigurationException
+     * @return data provider has single DocumentBuilder.
+     * @throws ParserConfigurationException if a DocumentBuilder cannot be
+     *         created which satisfies the configuration requested.
      */
     @DataProvider(name = "builder-provider")
     public Object[][] getBuilder() throws ParserConfigurationException {
@@ -60,17 +59,18 @@
     }
 
     /**
-     * Testcase to test the default functionality of isValidation method. Expect
+     * Test the default functionality of isValidation method. Expect
      * to return false because not setting the validation.
+     * @param docBuilder document builder instance.
      */
     @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl01(DocumentBuilder docBuilder) {
         assertFalse(docBuilder.isValidating());
-
     }
 
     /**
-     * Testcase to test the default functionality of isNamespaceAware method.
+     * Test the default functionality of isNamespaceAware method.
+     * @param docBuilder document builder instance.
      */
     @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl02(DocumentBuilder docBuilder) {
@@ -78,51 +78,71 @@
     }
 
     /**
-     * Testcase to test the parse(InputStream).
+     * Test the parse(InputStream).
+     * @param docBuilder document builder instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "builder-provider")
-    public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder) {
-        try {
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderImpl01.xml")));
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder)
+            throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
+                "DocumentBuilderImpl01.xml"))) {
+            assertNotNull(docBuilder.parse(fis));
         }
     }
 
     /**
-     * Testcase to test the parse(File).
+     * Test the parse(File).
+     *
+     * @param docBuilder document builder instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "builder-provider")
-    public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder) {
-        try {
-            Document doc = docBuilder.parse(new File(TestUtils.XML_DIR, "DocumentBuilderImpl01.xml"));
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder)
+            throws Exception {
+        assertNotNull(docBuilder.parse(new File(XML_DIR,
+                "DocumentBuilderImpl01.xml")));
+    }
+
+    /**
+     * Test the parse(InputStream,systemId).
+     * @param docBuilder document builder instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, 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()
+                    .toASCIIString() + FILE_SEP));
         }
     }
 
     /**
-     * Testcase to test the parse(InputStream,systemId).
-     */
-    @Test(dataProvider = "builder-provider")
-    public void testCheckDocumentBuilderImpl06(DocumentBuilder docBuilder) {
-        try {
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderImpl02.xml")), new File(TestUtils.XML_DIR).toURI()
-                    .toASCIIString() + FILE_SEP);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the setEntityResolver.
+     * Test the setEntityResolver.
+     * @param docBuilder document builder instance.
      */
     @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl07(DocumentBuilder docBuilder) {
         docBuilder.setEntityResolver(this);
-        resolveEntity("publicId", "http://www.myhost.com/today");
+        assertNotNull(resolveEntity("publicId", "http://www.myhost.com/today"));
     }
 
+    /**
+     * Allow the application to resolve external entities.
+     *
+     * @param publicId The public identifier of the external entity
+     *        being referenced, or null if none was supplied.
+     * @param systemId The system identifier of the external entity
+     *        being referenced.
+     * @return An InputSource object describing the new input source,
+     *         or null to request that the parser open a regular
+     *         URI connection to the system identifier.
+     */
+    @Override
     public InputSource resolveEntity(String publicId, String systemId) {
         if (systemId.equals("http://www.myhost.com/today"))
             return new InputSource(systemId);
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,6 +26,7 @@
 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;
@@ -35,7 +36,7 @@
  * Class containing the test cases for SAXParserFactory/DocumentBuilderFactory
  * newInstance methods.
  */
-public class FactoryConfErrorTest {
+public class FactoryConfErrorTest extends JAXPBaseTest {
 
     /**
      * Set properties DocumentBuilderFactory and SAXParserFactory to invalid
@@ -43,8 +44,8 @@
      */
     @BeforeTest
     public void setup() {
-        System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "xx");
-        System.setProperty("javax.xml.parsers.SAXParserFactory", "xx");
+        setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", "xx");
+        setSystemProperty("javax.xml.parsers.SAXParserFactory", "xx");
     }
 
     /**
@@ -53,8 +54,8 @@
      */
     @AfterTest
     public void cleanup() {
-        System.clearProperty("javax.xml.parsers.DocumentBuilderFactory");
-        System.clearProperty("javax.xml.parsers.SAXParserFactory");
+        setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", null);
+        setSystemProperty("javax.xml.parsers.SAXParserFactory", null);
     }
 
     /**
@@ -67,7 +68,7 @@
     }
 
     /**
-     * To test exeception thrown if javax.xml.parsers.DocumentBuilderFactory is
+     * To test exception thrown if javax.xml.parsers.DocumentBuilderFactory is
      * invalid.
      */
     @Test(expectedExceptions = FactoryConfigurationError.class)
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -22,24 +22,16 @@
  */
 
 package javax.xml.parsers.ptests;
-
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-
+import jaxp.library.JAXPBaseTest;
 import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
 
 /**
- * Class containing the test cases for SAXParserFactory API
+ * Class containing the test cases for SAXParserFactory API.
  */
-public class SAXParserFactTest {
+public class SAXParserFactTest extends JAXPBaseTest {
 
     private static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
     private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
@@ -49,20 +41,17 @@
     private static final String EXTERNAL_P_ENTITIES = "http://xml.org/sax/features/external-parameter-entities";
 
     /**
-     * Testcase to test if newSAXParser() method returns SAXParser.
+     * Test if newSAXParser() method returns SAXParser.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testParser01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            SAXParser saxparser = spf.newSAXParser();
-        } catch (ParserConfigurationException | SAXException e) {
-            failUnexpected(e);
-        }
+    public void testParser01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.newSAXParser();
     }
 
     /**
-     * Testcase to test the default functionality (No validation) of the parser.
+     * Test the default functionality (No validation) of the parser.
      */
     @Test
     public void testValidate01() {
@@ -71,7 +60,7 @@
     }
 
     /**
-     * Testcase to test the functionality of setValidating and isvalidating
+     * Test the functionality of setValidating and isvalidating
      * methods.
      */
     @Test
@@ -82,7 +71,7 @@
     }
 
     /**
-     * Parser should not be namespaceaware by default.
+     * Parser should not be namespace-aware by default.
      */
     @Test
     public void testNamespace01() {
@@ -91,7 +80,7 @@
     }
 
     /**
-     * Testcase to test the functionality of setNamespaceAware and
+     * Test the functionality of setNamespaceAware and
      * isNamespaceAware methods.
      */
     @Test
@@ -102,167 +91,132 @@
     }
 
     /**
-     * Testcase to test the functionality of setNamespaceAware and getFeature()
+     * Test the functionality of setNamespaceAware and getFeature()
      * methods for namespaces property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertFalse(spf.getFeature(NAMESPACES));
+    public void testFeature01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertFalse(spf.getFeature(NAMESPACES));
 
-            spf.setNamespaceAware(true);
-            assertTrue(spf.getFeature(NAMESPACES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+        spf.setNamespaceAware(true);
+        assertTrue(spf.getFeature(NAMESPACES));
     }
 
     /**
-     * Testcase to test the functionality of setFeature and getFeature methods
+     * Test the functionality of setFeature and getFeature methods
      * for namespaces property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
+    public void testFeature02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
 
-            spf.setFeature(NAMESPACES, true);
-            assertTrue(spf.getFeature(NAMESPACES));
+        spf.setFeature(NAMESPACES, true);
+        assertTrue(spf.getFeature(NAMESPACES));
 
-            spf.setFeature(NAMESPACES, false);
-            assertFalse(spf.getFeature(NAMESPACES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+        spf.setFeature(NAMESPACES, false);
+        assertFalse(spf.getFeature(NAMESPACES));
     }
 
     /**
-     * Testcase to test the functionality of setFeature and getFeature methods
+     * Test the functionality of setFeature and getFeature methods
      * for namespace-prefixes property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature03() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
+    public void testFeature03() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
 
-            spf.setFeature(NAMESPACE_PREFIXES, true);
-            assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
+        spf.setFeature(NAMESPACE_PREFIXES, true);
+        assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
 
-            spf.setFeature(NAMESPACE_PREFIXES, false);
-            assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+        spf.setFeature(NAMESPACE_PREFIXES, false);
+        assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
     }
 
     /**
-     * Testcase to test the functionality of getFeature method for
+     * Test the functionality of getFeature method for
      * string-interning property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature04() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertTrue(spf.getFeature(STRING_INTERNING));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+    public void testFeature04() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertTrue(spf.getFeature(STRING_INTERNING));
     }
 
     /**
-     * Testcase to test the functionality of getFeature and setValidating
+     * Test the functionality of getFeature and setValidating
      * methods for validation property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature05() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertFalse(spf.getFeature(VALIDATION));
-            spf.setValidating(true);
-            assertTrue(spf.getFeature(VALIDATION));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
-
+    public void testFeature05() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertFalse(spf.getFeature(VALIDATION));
+        spf.setValidating(true);
+        assertTrue(spf.getFeature(VALIDATION));
     }
 
     /**
-     * Testcase to test the functionality of setFeature and getFeature methods
+     * Test the functionality of setFeature and getFeature methods
      * for validation property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature06() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-
-            spf.setFeature(VALIDATION, true);
-            assertTrue(spf.getFeature(VALIDATION));
-
-            spf.setFeature(VALIDATION, false);
-            assertFalse(spf.getFeature(VALIDATION));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
-
+    public void testFeature06() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setFeature(VALIDATION, true);
+        assertTrue(spf.getFeature(VALIDATION));
+        spf.setFeature(VALIDATION, false);
+        assertFalse(spf.getFeature(VALIDATION));
     }
 
     /**
-     * Testcase to test the functionality of getFeature method for
+     * Test the functionality of getFeature method for
      * external-general-entities property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature07() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertTrue(spf.getFeature(EXTERNAL_G_ENTITIES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
-
+    public void testFeature07() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertTrue(spf.getFeature(EXTERNAL_G_ENTITIES));
     }
 
     /**
-     * Testcase to test the functionality of setFeature and getFeature methods
+     * Test the functionality of setFeature and getFeature methods
      * for external-general-entities property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature08() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setFeature(EXTERNAL_G_ENTITIES, false);
-            assertFalse(spf.getFeature(EXTERNAL_G_ENTITIES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+    public void testFeature08() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setFeature(EXTERNAL_G_ENTITIES, false);
+        assertFalse(spf.getFeature(EXTERNAL_G_ENTITIES));
     }
 
     /**
-     * Testcase to test the functionality of getFeature method for
+     * Test the functionality of getFeature method for
      * external-parameter-entities property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature09() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertTrue(spf.getFeature(EXTERNAL_P_ENTITIES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+    public void testFeature09() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertTrue(spf.getFeature(EXTERNAL_P_ENTITIES));
     }
 
     /**
-     * Testcase to test the functionality of setFeature method for
+     * Test the functionality of setFeature method for
      * external-parameter-entitie property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature10() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setFeature(EXTERNAL_P_ENTITIES, false);
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
-
+    public void testFeature10() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setFeature(EXTERNAL_P_ENTITIES, false);
+        assertFalse(spf.getFeature(EXTERNAL_P_ENTITIES));
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,16 +23,14 @@
 
 package javax.xml.parsers.ptests;
 
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FilePermission;
 import java.io.IOException;
-
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import org.xml.sax.HandlerBase;
@@ -43,16 +41,15 @@
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest {
-
+public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
     /**
      * Provide SAXParser.
      *
-     * @throws SAXException
-     * @throws ParserConfigurationException
+     * @return a data provider contains a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
     @DataProvider(name = "parser-provider")
-    public Object[][] getParser() throws ParserConfigurationException, SAXException {
+    public Object[][] getParser() throws Exception {
         SAXParserFactory spf = SAXParserFactory.newInstance();
         SAXParser saxparser = spf.newSAXParser();
         return new Object[][] { { saxparser } };
@@ -62,498 +59,454 @@
      * Test case with FileInputStream null, parsing should fail and throw
      * IllegalArgumentException.
      *
-     * @throws IllegalArgumentException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse01(SAXParser saxparser) throws IllegalArgumentException {
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse01(SAXParser saxparser) throws Exception {
+        FileInputStream instream = null;
+        saxparser.parse(instream, new HandlerBase());
+    }
+
+    /**
+     * Test with by setting URI as null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse02(SAXParser saxparser) throws Exception {
+        String uri = null;
+        saxparser.parse(uri, new HandlerBase());
+    }
+
+    /**
+     * Test with non-existence URI, parsing should fail and throw IOException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @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 {
-            FileInputStream instream = null;
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(instream, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+            saxparser.parse("", new HandlerBase());
+        } finally {
+            setPermissions();
         }
     }
 
     /**
-     * Testcase with an error in xml file, parsing should fail and throw
+     * Test with File null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse04(SAXParser saxparser) throws Exception {
+        File file = null;
+        saxparser.parse(file, new HandlerBase());
+    }
+
+    /**
+     * Test with empty string as File, parsing should fail and throw
      * SAXException.
      *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse02(SAXParser saxparser) throws SAXException {
+    public void testParse05(SAXParser saxparser) throws Exception {
+        String workingDir = getSystemProperty("user.dir");
+        setPermissions(new FilePermission(workingDir, "read"));
         try {
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
-            saxparser.parse(instream, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
+            saxparser.parse(new File(""), new HandlerBase());
+        } finally {
+            setPermissions();
         }
     }
 
     /**
-     * Testcase with a valid in xml file, parser should parse the xml document.
+     * Test with input source null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse03(SAXParser saxparser) {
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse06(SAXParser saxparser) throws Exception {
+        InputSource is = null;
+        saxparser.parse(is, new HandlerBase());
+    }
+
+    /**
+     * Test with FileInputStream null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse07(SAXParser saxparser) throws Exception {
+        FileInputStream instream = null;
+        saxparser.parse(instream, new DefaultHandler());
+    }
+
+    /**
+     * Test with URI null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse08(SAXParser saxparser) throws Exception {
+        String uri = null;
+        saxparser.parse(uri, new DefaultHandler());
+    }
+
+    /**
+     * Test with non-existence URI, parsing should fail and throw
+     * SAXException or IOException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @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 {
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
-        } catch (IOException | SAXException e) {
-            failUnexpected(e);
+            saxparser.parse(uri, new DefaultHandler());
+        } finally {
+            setPermissions();
         }
     }
 
     /**
-     * Testcase with valid input stream, parser should parse the xml document
-     * successfully.
+     * Test with empty string as File, parsing should fail and throw
+     * SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse04(SAXParser saxparser) {
+    @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 {
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
-            saxparser.parse(instream, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+            saxparser.parse(file, new DefaultHandler());
+        } finally {
+            setPermissions();
         }
     }
 
     /**
-     * Testcase with valid input source, parser should parse the xml document
-     * successfully.
+     * Test with File null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse05(SAXParser saxparser) {
-        try {
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "parsertest.xml"));
-            saxparser.parse(instream, handler, new File(TestUtils.XML_DIR).toURI().toASCIIString());
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse11(SAXParser saxparser) throws Exception {
+        saxparser.parse((File) null, new DefaultHandler());
+    }
+
+    /**
+     * Test with input source null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse12(SAXParser saxparser) throws Exception {
+        InputSource is = null;
+        saxparser.parse(is, new DefaultHandler());
+    }
+
+    /**
+     * Test with an error in XML file, parsing should fail and throw
+     * SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse13(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(new File(
+                XML_DIR, "invalid.xml"))) {
+            saxparser.parse(instream, new HandlerBase());
         }
     }
 
     /**
-     * Testcase with uri null, parsing should fail and throw
-     * IllegalArgumentException.
+     * Test with a valid in XML file, parser should parse the XML document.
      *
-     * @throws IllegalArgumentException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse07(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            String uri = null;
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(uri, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse14(SAXParser saxparser) throws Exception {
+        saxparser.parse(new File(XML_DIR, "parsertest.xml"),
+                new HandlerBase());
+    }
+
+    /**
+     * Test with valid input stream, parser should parse the XML document
+     * successfully.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse15(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
+                "correct.xml"))) {
+            saxparser.parse(instream, new HandlerBase());
         }
     }
 
     /**
-     * Testcase with non-existant uri, parsing should fail and throw
-     * IOException.
+     * Test with valid input source, parser should parse the XML document
+     * successfully.
      *
-     * @throws SAXException
-     * @throws IOException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
-    public void testParse08(SAXParser saxparser) throws SAXException, IOException {
-        String uri = " ";
-
-        HandlerBase handler = new HandlerBase();
-        saxparser.parse(uri, handler);
-
-    }
-
-    /**
-     * Testcase with proper uri, parser should parse successfully.
-     */
-    @Test(dataProvider = "parser-provider")
-    public void testParse09(SAXParser saxparser) {
-        try {
-            File file = new File(TestUtils.XML_DIR, "correct.xml");
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(file.toURI().toASCIIString(), handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse16(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "parsertest.xml"))) {
+            saxparser.parse(instream, new HandlerBase(),
+                    new File(XML_DIR).toURI().toASCIIString());
         }
     }
 
     /**
-     * Testcase with File null, parsing should fail and throw
-     * IllegalArgumentException.
+     * Test with proper URI, parser should parse successfully.
      *
-     * @throws IllegalArgumentException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse10(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            File file = null;
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(file, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, 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());
+    }
+
+    /**
+     * Test with XML file that has errors parsing should fail and throw
+     * SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse18(SAXParser saxparser) throws Exception {
+        saxparser.parse(new File(XML_DIR, "valid.xml"), new HandlerBase());
+    }
+
+    /**
+     * Test with XML file that has no errors Parser should successfully
+     * parse the XML document.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse19(SAXParser saxparser) throws Exception {
+        saxparser.parse(new File(XML_DIR, "correct.xml"), new HandlerBase());
+    }
+
+    /**
+     * Test with input source attached an invalid XML, parsing should fail
+     * and throw SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse20(SAXParser saxparser) throws Exception {
+        try(FileInputStream instream = new FileInputStream(new File(XML_DIR,
+                "invalid.xml"))) {
+            saxparser.parse(new InputSource(instream), new HandlerBase());
         }
     }
 
     /**
-     * Testcase with empty string as File, parsing should fail and throw
-     * SAXException.
+     * Test with input source attached an valid XML, parser should
+     * successfully parse the XML document.
      *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse11(SAXParser saxparser) throws SAXException {
-        try {
-            HandlerBase handler = new HandlerBase();
-            File file = new File("");
-            saxparser.parse(file, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse21(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
+                "correct.xml"))) {
+            saxparser.parse(new InputSource(instream), new HandlerBase());
         }
     }
 
     /**
-     * Testcase with xml file that has errors parsing should fail and throw
+     * Test with an error in xml file, parsing should fail and throw
      * SAXException.
      *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse12(SAXParser saxparser) throws SAXException {
-        try {
-            HandlerBase handler = new HandlerBase();
-            File file = new File(TestUtils.XML_DIR, "valid.xml");
-            saxparser.parse(file, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse22(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "invalid.xml"))) {
+            saxparser.parse(instream, new DefaultHandler());
         }
     }
 
     /**
-     * Testcase with xml file that has no errors Parser should successfully
-     * parse the xml document.
+     * Test with valid input stream, parser should parse the XML document
+     * successfully.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse13(SAXParser saxparser) {
-        try {
-            HandlerBase handler = new HandlerBase();
-            File file = new File(TestUtils.XML_DIR, "correct.xml");
-            saxparser.parse(file, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse23(SAXParser saxparser) throws Exception {
+        DefaultHandler handler = new DefaultHandler();
+        saxparser.parse(new File(XML_DIR, "parsertest.xml"), handler);
     }
 
     /**
-     * Testcase with input source null, parsing should fail and throw
-     * IllegalArgumentException.
+     * Test with valid input stream, parser should parse the XML document
+     * successfully.
      *
-     * @throws IllegalArgumentException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse14(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            InputSource is = null;
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(is, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse24(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
+                "correct.xml"))) {
+            DefaultHandler handler = new DefaultHandler();
+            saxparser.parse(instream, handler);
         }
     }
 
     /**
-     * Testcase with input source attached an invaild xml, parsing should fail
-     * and throw SAXException.
+     * Test with valid input source, parser should parse the XML document
+     * successfully.
      *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse15(SAXParser saxparser) throws SAXException {
-        try {
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
-            InputSource is = new InputSource(instream);
-            saxparser.parse(is, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse25(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "parsertest.xml"))) {
+            saxparser.parse(instream, new DefaultHandler(),
+                new File(XML_DIR).toURI().toASCIIString());
         }
     }
 
     /**
-     * Testcase with input source attached an vaild xml, parser should
-     * successfully parse the xml document.
+     * Test with proper URI, parser should parse successfully.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse16(SAXParser saxparser) {
-        try {
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
-            InputSource is = new InputSource(instream);
-            saxparser.parse(is, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, 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());
+    }
+
+    /**
+     * Test with XML file that has errors, parsing should fail and throw
+     * SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse27(SAXParser saxparser) throws Exception {
+        saxparser.parse(new File(XML_DIR, "valid.xml"), new DefaultHandler());
+    }
+
+    /**
+     * Test with XML file that has no errors, parser should successfully
+     * parse the XML document.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse28(SAXParser saxparser) throws Exception {
+        saxparser.parse(new File(XML_DIR, "correct.xml"), new DefaultHandler());
+    }
+
+    /**
+     * Test with an invalid XML file, parser should throw SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse29(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "invalid.xml"))) {
+            saxparser.parse(new InputSource(instream), new DefaultHandler());
         }
     }
 
     /**
-     * Testcase with FileInputStream null, parsing should fail and throw
-     * IllegalArgumentException.
+     * Test case to parse an XML file that not use namespaces.
      *
-     * @throws IllegalArgumentException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse17(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            FileInputStream instream = null;
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse(instream, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse30(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "correct.xml"))) {
+            saxparser.parse(new InputSource(instream), new DefaultHandler());
         }
     }
 
     /**
-     * Testcase with an error in xml file, parsing should fail and throw
-     * SAXException.
+     * Test case to parse an XML file that uses namespaces.
      *
-     * @throws SAXException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse18(SAXParser saxparser) throws SAXException {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
-            saxparser.parse(instream, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with valid input stream, parser should parse the xml document
-     * successfully.
-     */
-    @Test(dataProvider = "parser-provider")
-    public void testParse19(SAXParser saxparser) {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
-        } catch (IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with valid input stream, parser should parse the xml document
-     * successfully.
-     */
-    @Test(dataProvider = "parser-provider")
-    public void testParse20(SAXParser saxparser) {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
-            saxparser.parse(instream, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with valid input source, parser should parse the xml document
-     * successfully.
-     */
-    @Test(dataProvider = "parser-provider")
-    public void testParse21(SAXParser saxparser) {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "parsertest.xml"));
-            saxparser.parse(instream, handler, new File(TestUtils.XML_DIR).toURI().toASCIIString());
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * Testcase with uri null, parsing should fail and throw
-     * IllegalArgumentException.
-     *
-     * @throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse23(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            String uri = null;
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse(uri, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with non-existant uri, parsing should fail and throw
-     * SAXException or IOException.
-     *
-     * @throws SAXException
-     * @throws IOException
-     */
-    @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
-    public void testParse24(SAXParser saxparser) throws SAXException, IOException {
-        String uri = " ";
-        DefaultHandler handler = new DefaultHandler();
-        saxparser.parse(uri, handler);
-
-    }
-
-    /**
-     * Testcase with proper uri, parser should parse successfully.
-     */
-    @Test(dataProvider = "parser-provider")
-    public void testParse25(SAXParser saxparser) {
-        try {
-            File file = new File(TestUtils.XML_DIR, "correct.xml");
-
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse(file.toURI().toASCIIString(), handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with File null, parsing should fail and throw
-     * IllegalArgumentException.
-     *
-     * @throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse26(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse((File) null, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with empty string as File, parsing should fail and throw
-     * SAXException.
-     *
-     * @throws SAXException
-     */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse27(SAXParser saxparser) throws SAXException {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            File file = new File("");
-            saxparser.parse(file, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with xml file that has errors, parsing should fail and throw
-     * SAXException.
-     *
-     * @throws SAXException
-     */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse28(SAXParser saxparser) throws SAXException {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            File file = new File(TestUtils.XML_DIR, "valid.xml");
-            saxparser.parse(file, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with xml file that has no errors, parser should successfully
-     * parse the xml document.
-     */
-    @Test(dataProvider = "parser-provider")
-    public void testParse29(SAXParser saxparser) {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            File file = new File(TestUtils.XML_DIR, "correct.xml");
-            saxparser.parse(file, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with input source null, parsing should fail and throw
-     * IllegalArgumentException.
-     *
-     * @throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse30(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            InputSource is = null;
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse(is, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with an invalid xml file, parser should throw SAXException.
-     *
-     * @throws SAXException
-     */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse31(SAXParser saxparser) throws SAXException {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
-            InputSource is = new InputSource(instream);
-            saxparser.parse(is, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Test case to parse an xml file that not use namespaces.
-     */
-    @Test(dataProvider = "parser-provider")
-    public void testParse32(SAXParser saxparser) {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
-            InputSource is = new InputSource(instream);
-            saxparser.parse(is, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Test case to parse an xml file that uses namespaces.
-     */
-    @Test
-    public void testParse33() {
-        try {
+    @Test(groups = {"readLocalFiles"})
+    public void testParse31() throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "ns4.xml"))) {
             SAXParserFactory spf = SAXParserFactory.newInstance();
             spf.setNamespaceAware(true);
-            SAXParser saxparser = spf.newSAXParser();
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "ns4.xml"));
-            saxparser.parse(instream, handler);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
+            spf.newSAXParser().parse(instream, new HandlerBase());
         }
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,260 +23,239 @@
 
 package javax.xml.parsers.ptests;
 
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
-
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
 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.Test;
-import org.xml.sax.Parser;
 import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.XMLReader;
 import org.xml.sax.ext.DeclHandler;
 import org.xml.sax.ext.LexicalHandler;
 
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest02 {
-    final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
-    final String XML_STRING = "http://xml.org/sax/properties/xml-string";
-    final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler";
-    final String LEXICAL_HANDLER = "http://xml.org/sax/properties/lexical-handler";
+public class SAXParserTest02 extends JAXPBaseTest {
+    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";
+    private static final String LEXICAL_HANDLER = "http://xml.org/sax/properties/lexical-handler";
 
     /**
      * Provide SAXParser.
      *
-     * @throws SAXException
-     * @throws ParserConfigurationException
+     * @return a data provider contains a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
     @DataProvider(name = "parser-provider")
-    public Object[][] getParser() throws ParserConfigurationException, SAXException {
+    public Object[][] getParser() throws Exception {
         SAXParserFactory spf = SAXParserFactory.newInstance();
         SAXParser saxparser = spf.newSAXParser();
         return new Object[][] { { saxparser } };
     }
 
     /**
-     * Testcase to test the default functionality (No validation) of the parser.
+     * Test to test the default functionality (No validation) of the parser.
+     *
+     * @param saxparser a SAXParser instance.
      */
     @Test(dataProvider = "parser-provider")
     public void testValidate01(SAXParser saxparser) {
-        try {
-            assertFalse(saxparser.isValidating());
-        } catch (FactoryConfigurationError e) {
-            failUnexpected(e);
-        }
-
+        assertFalse(saxparser.isValidating());
     }
 
     /**
-     * Testcase to test the functionality of setValidating and isvalidating
+     * Test to test the functionality of setValidating and isValidating
      * methods.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testValidate02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setValidating(true);
-            spf.newSAXParser();
-            assertTrue(spf.isValidating());
-        } catch (FactoryConfigurationError | ParserConfigurationException | SAXException e) {
-            failUnexpected(e);
-        }
-
+    public void testValidate02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setValidating(true);
+        spf.newSAXParser();
+        assertTrue(spf.isValidating());
     }
 
     /**
-     * Test case to test isNamespaceAware() method. By default, namespaces are
+     * Test isNamespaceAware() method. By default, namespaces are
      * not supported.
+     *
+     * @param saxparser a SAXParser instance.
      */
     @Test(dataProvider = "parser-provider")
     public void testNamespace01(SAXParser saxparser) {
-        try {
-            assertFalse(saxparser.isNamespaceAware());
-        } catch (FactoryConfigurationError e) {
-            failUnexpected(e);
-        }
-
+        assertFalse(saxparser.isNamespaceAware());
     }
 
     /**
      * Test case to test setnamespaceAware() method.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testNamespace02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxparser = spf.newSAXParser();
-            assertTrue(saxparser.isNamespaceAware());
-        } catch (FactoryConfigurationError | ParserConfigurationException | SAXException e) {
-            failUnexpected(e);
-        }
-
+    public void testNamespace02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        SAXParser saxparser = spf.newSAXParser();
+        assertTrue(saxparser.isNamespaceAware());
     }
 
     /**
      * Test case to test if the getParser() method returns instance of Parser.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testParser01(SAXParser saxparser) {
-        try {
-            Parser parser = saxparser.getParser();
-        } catch (FactoryConfigurationError | SAXException e) {
-            failUnexpected(e);
-        }
-
+    public void testParser01(SAXParser saxparser) throws SAXException {
+        assertNotNull(saxparser.getParser());
     }
 
     /**
      * Test case to test if the getXMLReader() method returns instance of
      * XMLReader.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testXmlReader01(SAXParser saxparser) {
-        try {
-            XMLReader xmlReader = saxparser.getXMLReader();
-        } catch (FactoryConfigurationError | SAXException e) {
-            failUnexpected(e);
-        }
+    public void testXmlReader01(SAXParser saxparser) throws SAXException {
+        assertNotNull(saxparser.getXMLReader());
     }
 
     /**
      * Test whether the xml-string property is not supported.
      *
-     * @throws SAXNotSupportedException
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
-    @Test(expectedExceptions = SAXNotSupportedException.class, dataProvider = "parser-provider")
-    public void testProperty01(SAXParser saxparser) throws SAXNotSupportedException {
-        try {
-            Object object = saxparser.getProperty(XML_STRING);
-        } catch (SAXNotRecognizedException e) {
-            failUnexpected(e);
-        }
+    @Test(expectedExceptions = SAXNotSupportedException.class,
+            dataProvider = "parser-provider")
+    public void testProperty01(SAXParser saxparser) throws SAXException {
+        saxparser.getProperty(XML_STRING);
     }
 
     /**
      * Test whether the dom-node property is not supported.
      *
-     * @throws SAXNotSupportedException
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
-    @Test(expectedExceptions = SAXNotSupportedException.class, dataProvider = "parser-provider")
-    public void testProperty02(SAXParser saxparser) throws SAXNotSupportedException {
-        try {
-            Object object = saxparser.getProperty(DOM_NODE);
-        } catch (SAXNotRecognizedException e) {
-            failUnexpected(e);
-        }
+    @Test(expectedExceptions = SAXNotSupportedException.class,
+            dataProvider = "parser-provider")
+    public void testProperty02(SAXParser saxparser) throws SAXException {
+        saxparser.getProperty(DOM_NODE);
     }
 
     /**
      * Test the default lexical-handler not exists.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testProperty03(SAXParser saxparser) {
-        try {
-            assertNull(saxparser.getProperty(LEXICAL_HANDLER));
-        } catch (SAXException e) {
-            failUnexpected(e);
-        }
-
+    public void testProperty03(SAXParser saxparser) throws SAXException {
+        assertNull(saxparser.getProperty(LEXICAL_HANDLER));
     }
 
     /**
      * Test the default declaration-handler not exists.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testProperty04(SAXParser saxparser) {
-
-        try {
-            assertNull(saxparser.getProperty(DECL_HANDLER));
-        } catch (SAXException e) {
-            failUnexpected(e);
-        }
+    public void testProperty04(SAXParser saxparser) throws SAXException {
+        assertNull(saxparser.getProperty(DECL_HANDLER));
     }
 
     /**
      * Test to set and get the lexical-handler.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testProperty05(SAXParser saxparser) {
-        try {
-            MyLexicalHandler myLexicalHandler = new MyLexicalHandler();
-            saxparser.setProperty(LEXICAL_HANDLER, myLexicalHandler);
-            Object object = saxparser.getProperty(LEXICAL_HANDLER);
-            assertTrue(object instanceof LexicalHandler);
-        } catch (SAXException e) {
-            failUnexpected(e);
-        }
+    public void testProperty05(SAXParser saxparser) throws SAXException {
+        MyLexicalHandler myLexicalHandler = new MyLexicalHandler();
+        saxparser.setProperty(LEXICAL_HANDLER, myLexicalHandler);
+        assertTrue(saxparser.getProperty(LEXICAL_HANDLER) instanceof LexicalHandler);
     }
 
     /**
      * Test to set and get the declaration-handler.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testProperty06(SAXParser saxparser) {
-        try {
-            MyDeclHandler myDeclHandler = new MyDeclHandler();
-            saxparser.setProperty(DECL_HANDLER, myDeclHandler);
-            Object object = saxparser.getProperty(DECL_HANDLER);
-            assertTrue(object instanceof DeclHandler);
-        } catch (SAXException e) {
-            failUnexpected(e);
-        }
-
+    public void testProperty06(SAXParser saxparser) throws SAXException {
+        MyDeclHandler myDeclHandler = new MyDeclHandler();
+        saxparser.setProperty(DECL_HANDLER, myDeclHandler);
+        assertTrue(saxparser.getProperty(DECL_HANDLER) instanceof DeclHandler);
     }
 
     /**
-     * Customized LexicalHandler used for test.
+     * Customized LexicalHandler used for test. An empty implementation for
+     * LexicalHandler.
      */
     private class MyLexicalHandler implements LexicalHandler {
 
+        @Override
         public void comment(char[] ch, int start, int length) {
         }
 
+        @Override
         public void endCDATA() {
         }
 
+        @Override
         public void endDTD() {
         }
 
+        @Override
         public void endEntity(String name) {
         }
 
+        @Override
         public void startCDATA() {
         }
 
+        @Override
         public void startDTD(String name, String publicId, String systemId) {
         }
 
+        @Override
         public void startEntity(String name) {
         }
     }
 
     /**
-     * Customized DeclHandler used for test.
+     * Customized DeclHandler used for test. An empty implementation for
+     * DeclHandler.
      */
     private class MyDeclHandler implements DeclHandler {
 
+        @Override
         public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) {
         }
 
+        @Override
         public void elementDecl(String name, String model) {
         }
 
+        @Override
         public void externalEntityDecl(String name, String publicId, String systemId) {
         }
 
+        @Override
         public void internalEntityDecl(String name, String value) {
         }
     }
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -23,17 +23,17 @@
 
 package javax.xml.parsers.ptests;
 
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
-
 import java.io.File;
-import java.io.IOException;
-
-import javax.xml.parsers.ParserConfigurationException;
+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.Test;
 import org.xml.sax.SAXException;
@@ -41,68 +41,70 @@
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest03 {
+public class SAXParserTest03 extends JAXPFileReadOnlyBaseTest {
 
     /**
      * Provide SAXParserFactory.
      *
-     * @throws Exception
+     * @return a dimensional contains.
      */
     @DataProvider(name = "input-provider")
     public Object[][] getFactory() {
         SAXParserFactory spf = SAXParserFactory.newInstance();
         spf.setValidating(true);
-        MyErrorHandler handler = MyErrorHandler.newInstance();
-        return new Object[][] { { spf, handler } };
+        return new Object[][] { { spf, MyErrorHandler.newInstance() } };
     }
 
     /**
      * parsertest.xml holds a valid document. This method tests the validating
      * parser.
+     *
+     * @param spf a Parser factory.
+     * @param handler an error handler for capturing events.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "input-provider")
-    public void testParseValidate01(SAXParserFactory spf, MyErrorHandler handler) {
-        try {
-            SAXParser saxparser = spf.newSAXParser();
-            saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
-            assertFalse(handler.errorOccured);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    public void testParseValidate01(SAXParserFactory spf, MyErrorHandler handler)
+            throws Exception {
+            spf.newSAXParser().parse(new File(XML_DIR, "parsertest.xml"), handler);
+            assertFalse(handler.isErrorOccured());
     }
 
     /**
      * validns.xml holds a valid document with XML namespaces in it. This method
      * tests the Validating parser with namespace processing on.
+     *
+     * @param spf a Parser factory.
+     * @param handler an error handler for capturing events.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "input-provider")
-    public void testParseValidate02(SAXParserFactory spf, MyErrorHandler handler) {
-        try {
+    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    public void testParseValidate02(SAXParserFactory spf, MyErrorHandler handler)
+            throws Exception {
             spf.setNamespaceAware(true);
-            SAXParser saxparser = spf.newSAXParser();
-            saxparser.parse(new File(TestUtils.XML_DIR, "validns.xml"), handler);
-            assertFalse(handler.errorOccured);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+            spf.newSAXParser().parse(new File(XML_DIR, "validns.xml"), handler);
+            assertFalse(handler.isErrorOccured());
     }
 
     /**
      * invalidns.xml holds an invalid document with XML namespaces in it. This
      * method tests the validating parser with namespace processing on. It
      * should throw validation error.
+     *
+     * @param spf a Parser factory.
+     * @param handler an error handler for capturing events.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "input-provider")
-    public void testParseValidate03(SAXParserFactory spf, MyErrorHandler handler) {
+    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    public void testParseValidate03(SAXParserFactory spf, MyErrorHandler handler)
+            throws Exception {
         try {
             spf.setNamespaceAware(true);
             SAXParser saxparser = spf.newSAXParser();
-            saxparser.parse(new File(TestUtils.XML_DIR, "invalidns.xml"), handler);
-            failUnexpected(new RuntimeException());
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            if (e instanceof SAXException) {
-                assertTrue(handler.errorOccured);
-            }
+            saxparser.parse(new File(XML_DIR, "invalidns.xml"), handler);
+            fail("Expecting SAXException here");
+        } catch (SAXException e) {
+            assertTrue(handler.isErrorOccured());
         }
     }
 
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/TestUtils.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +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 javax.xml.parsers.ptests;
-
-import static jaxp.library.JAXPTestUtilities.ERROR_MSG_HEADER;
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.StandardCopyOption;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.LocatorImpl;
-
-/**
- * Utility interface which includes final variables of xml, golden file
- * directories.
- */
-interface TestUtils {
-    final String XML_DIR = System.getProperty("test.src", ".") + FILE_SEP + "javax/xml/parsers/xmlfiles";
-    final String GOLDEN_DIR = XML_DIR + FILE_SEP + "out";
-}
-
-/**
- * Customized DefaultHandler which writes output document when methods are
- * called by Transformer. Test may use output document to compare with golden
- * file for verification.
- */
-class MyCHandler extends DefaultHandler {
-
-    private final BufferedWriter bWriter;
-    private final Locator locator = new LocatorImpl();
-
-    private MyCHandler(File file) throws IOException {
-        bWriter = new BufferedWriter(new FileWriter(file));
-    }
-
-    public static MyCHandler newInstance(File file) throws IOException {
-        MyCHandler handler = new MyCHandler(file);
-        return handler;
-    }
-
-    public void characters(char[] ch, int start, int length) {
-        String s = new String(ch, start, length);
-        String str = String.format("characters...length is:%d\n<%s>", s.length(), s);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void endDocument() {
-        String str = "endDocument...";
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-            bWriter.flush();
-            bWriter.close();
-
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void endElement(String namespaceURI, String localName, String qName) {
-        String str = String.format("endElement...\nnamespaceURI: <%s> localName: <%s> qName: <%s>", namespaceURI, localName, qName);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void endPrefixMapping(String prefix) {
-        String str = String.format("endPrefixMapping...\nprefix: <%s>", prefix);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void ignorableWhitespace(char[] ch, int start, int length) {
-        String s = new String(ch, start, length);
-        String str = String.format("ignorableWhitespace...\n%s ignorable white space string length: %d", s, s.length());
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void processingInstruction(String target, String data) {
-        String str = String.format("processingInstruction...target:<%s> data: <%s>", target, data);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void skippedEntity(String name) {
-        String str = String.format("skippedEntity...\nname: <%s>", name);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void startDocument() {
-        String str = "startDocument...";
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
-        String str = String.format("startElement...\nnamespaceURI: <%s> localName: <%s> qName: <%s> Number of Attributes: <%d> Line# <%d>", namespaceURI,
-                localName, qName, atts.getLength(), locator.getLineNumber());
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void startPrefixMapping(String prefix, String uri) {
-        String str = String.format("startPrefixMapping...\nprefix: <%s> uri: <%s>", prefix, uri);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-}
-
-/**
- * Customized DefaultHandler used for SAXParseException testing.
- */
-class MyErrorHandler extends DefaultHandler {
-    boolean errorOccured = false;
-
-    private MyErrorHandler() {
-    }
-
-    public static MyErrorHandler newInstance() {
-        return new MyErrorHandler();
-    }
-
-    public void error(SAXParseException e) {
-        errorOccured = true;
-    }
-
-    public void warning(SAXParseException e) {
-        errorOccured = true;
-    }
-
-    public void fatalError(SAXParseException e) {
-        errorOccured = true;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2003, 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 javax.xml.transform.ptests;
+
+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.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * DOM parse on test file to be compared with golden output file. No Exception
+ * is expected.
+ */
+public class DOMResultTest extends JAXPFileBaseTest {
+    /**
+     * Unit test for simple DOM parsing.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase01() throws Exception {
+        String resultFile = USER_DIR  + "domresult01.out";
+        String goldFile = GOLDEN_DIR  + "domresult01GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        XMLReader reader = XMLReaderFactory.createXMLReader();
+        SAXTransformerFactory saxTFactory
+                = (SAXTransformerFactory) TransformerFactory.newInstance();
+        SAXSource saxSource = new SAXSource(new InputSource(xsltFile));
+        TransformerHandler handler
+                = saxTFactory.newTransformerHandler(saxSource);
+
+        DOMResult result = new DOMResult();
+
+        handler.setResult(result);
+        reader.setContentHandler(handler);
+        reader.parse(xmlFile);
+
+        Node node = result.getNode();
+        try (BufferedWriter writer = new BufferedWriter(new FileWriter(resultFile))) {
+            writeNodes(node, writer);
+        }
+        assertTrue(compareWithGold(goldFile, resultFile));
+    }
+
+    /**
+     * Prints all node names, attributes to file
+     * @param node a node that need to be recursively access.
+     * @param bWriter file writer.
+     * @throws IOException if writing file failed.
+     */
+    private void writeNodes(Node node, BufferedWriter bWriter) throws IOException {
+        String str = "Node: " + node.getNodeName();
+        bWriter.write( str, 0,str.length());
+        bWriter.newLine();
+
+        NamedNodeMap nnm = node.getAttributes();
+        if (nnm != null && nnm.getLength() > 0)
+            for (int i=0; i<nnm.getLength(); i++) {
+                str = "AttributeName:" + ((Attr) nnm.item(i)).getName() +
+                      ", AttributeValue:" +((Attr) nnm.item(i)).getValue();
+                bWriter.write( str, 0,str.length());
+                bWriter.newLine();
+            }
+
+        NodeList kids = node.getChildNodes();
+        if (kids != null)
+            for (int i=0; i<kids.getLength(); i++)
+                writeNodes(kids.item(i), bWriter);
+    }
+}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest01.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +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 javax.xml.transform.ptests;
-
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-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 static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * DOM parse on test file to be compared with golden output file. No Exception
- * is expected.
- */
-public class DOMResultTest01 {
-    /**
-     * Unit test for simple DOM parsing.
-     */
-    @Test
-    public void testcase01() {
-        String resultFile = CLASS_DIR  + "domresult01.out";
-        String goldFile = GOLDEN_DIR  + "domresult01GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory) TransformerFactory.newInstance();
-            SAXSource saxSource = new SAXSource(new InputSource(xsltFile));
-            TransformerHandler handler
-                    = saxTFactory.newTransformerHandler(saxSource);
-
-            DOMResult result = new DOMResult();
-
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-
-            Node node = result.getNode();
-            try (BufferedWriter writer = new BufferedWriter(new FileWriter(resultFile))) {
-                writeNodes(node, writer);
-            }
-            assertTrue(compareWithGold(goldFile, resultFile));
-        } catch (SAXException | TransformerConfigurationException
-                | IllegalArgumentException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if(Files.exists(resultPath))
-                    Files.delete(resultPath);
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
-        }
-    }
-
-    /**
-     * Prints all node names, attributes to file
-     * @param node a node that need to be recursively access.
-     * @param bWriter file writer.
-     * @throws IOException if writing file failed.
-     */
-    private void writeNodes(Node node, BufferedWriter bWriter) throws IOException {
-        String str = "Node: " + node.getNodeName();
-        bWriter.write( str, 0,str.length());
-        bWriter.newLine();
-
-        NamedNodeMap nnm = node.getAttributes();
-        if (nnm != null && nnm.getLength() > 0)
-            for (int i=0; i<nnm.getLength(); i++) {
-                str = "AttributeName:" + ((Attr) nnm.item(i)).getName() +
-                      ", AttributeValue:" +((Attr) nnm.item(i)).getValue();
-                bWriter.write( str, 0,str.length());
-                bWriter.newLine();
-            }
-
-        NodeList kids = node.getChildNodes();
-        if (kids != null)
-            for (int i=0; i<kids.getLength(); i++)
-                writeNodes(kids.item(i), bWriter);
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,12 +24,14 @@
 package javax.xml.transform.ptests;
 
 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.Test;
@@ -37,7 +39,7 @@
 /**
  * Class containing the test cases for ErrorListener interface
  */
-public class ErrorListenerTest implements ErrorListener {
+public class ErrorListenerTest extends JAXPBaseTest implements ErrorListener {
     /**
      * Define ErrorListener's status.
      */
@@ -58,9 +60,10 @@
         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("We expect an Exception here");
+            fail("Expect TransformerConfigurationException here");
         } catch (TransformerConfigurationException ex) {
             assertEquals(listener.status, ListenerStatus.FATAL);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2003, 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 javax.xml.transform.ptests;
+
+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.Test;
+import org.xml.sax.InputSource;
+
+
+/**
+ * Unit test for SAXSource sourceToInputSource API.
+ */
+public class SAXSourceTest extends JAXPFileReadOnlyBaseTest {
+    /**
+     * Test style-sheet file name
+     */
+    private final String TEST_FILE = XML_DIR + "cities.xsl";
+
+    /**
+     * Test obtaining a SAX InputSource object from a Source object.
+     *
+     * @throws IOException reading file error.
+     */
+    @Test(groups = {"readLocalFiles"})
+    public void source2inputsource01() throws IOException {
+        try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
+            StreamSource streamSource = new StreamSource(fis);
+            assertNotNull(SAXSource.sourceToInputSource(streamSource));
+        }
+    }
+
+    /**
+     * This test case tries to get InputSource from DOMSource using
+     * sourceToInputSource method. It is not possible and hence null is
+     * expected. This is a negative test case,
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"})
+    public void source2inputsource02() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.newDocumentBuilder().parse(new File(TEST_FILE));
+        assertNull(SAXSource.sourceToInputSource(new DOMSource(null)));
+    }
+
+    /**
+     * This test case tries to get InputSource from SAXSource using
+     * sourceToInputSource method. This will also check if the systemId
+     * remained the same. This is a positive test case.
+     *
+     * @throws IOException reading file error.
+     */
+    @Test(groups = {"readLocalFiles"})
+    public void source2inputsource03() throws IOException {
+        String SYSTEM_ID = "file:///" + XML_DIR;
+        try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
+            SAXSource saxSource =
+                    new SAXSource(new InputSource(fis));
+            saxSource.setSystemId(SYSTEM_ID);
+            assertEquals(SAXSource.sourceToInputSource(saxSource).getSystemId(),
+                    SYSTEM_ID);
+        }
+    }
+}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest01.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +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 javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-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 static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import org.testng.annotations.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-
-/**
- * Unit test for SAXSource sourceToInputSource API.
- */
-public class SAXSourceTest01 {
-    /**
-     * Test file name
-     */
-    private final String TEST_FILE = XML_DIR + "cities.xsl";
-
-    /**
-     * Test obtaining a SAX InputSource object from a Source object.
-     */
-    @Test
-    public void source2inputsource01() {
-        try {
-            StreamSource streamSource = new StreamSource (
-                                new FileInputStream (TEST_FILE));
-            assertNotNull(SAXSource.sourceToInputSource(streamSource));
-        } catch (FileNotFoundException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * This test case tries to get InputSource from DOMSource using
-     * sourceToInputSource method. It is not possible and hence null is
-     * expected. This is a negative test case
-     */
-    @Test
-    public void source2inputsource02() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            dbf.newDocumentBuilder().parse(new File(TEST_FILE));
-            assertNull(SAXSource.sourceToInputSource(new DOMSource(null)));
-        } catch (ParserConfigurationException | SAXException | IOException ex) {
-            failUnexpected(ex);
-        }
-
-    }
-
-    /**
-     * This test case tries to get InputSource from SAXSource using
-     * sourceToInputSource method. This will also check if the systemId
-     * remained the same. This is a positive test case.
-     */
-    @Test
-    public void source2inputsource03() {
-        String SYSTEM_ID = "file:///" + XML_DIR;
-        try {
-            SAXSource saxSource =
-                    new SAXSource(new InputSource(new FileInputStream(TEST_FILE)));
-            saxSource.setSystemId(SYSTEM_ID);
-            assertEquals(SAXSource.sourceToInputSource(saxSource).getSystemId(),
-                    SYSTEM_ID);
-        } catch (FileNotFoundException ex) {
-            failUnexpected(ex);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -0,0 +1,423 @@
+/*
+ * Copyright (c) 2003, 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 javax.xml.transform.ptests;
+
+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.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLFilter;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test newTransformerhandler() method which takes StreamSource as argument can
+ * be set to XMLReader.
+ */
+public class SAXTFactoryTest extends JAXPFileBaseTest {
+    /**
+     * Test style-sheet file.
+     */
+    private static final String XSLT_FILE = XML_DIR + "cities.xsl";
+
+    /**
+     * Test style-sheet file.
+     */
+    private static final String XSLT_INCL_FILE = XML_DIR + "citiesinclude.xsl";
+
+    /**
+     * Test XML file.
+     */
+    private static final String XML_FILE = XML_DIR + "cities.xml";
+
+    /**
+     * SAXTFactory.newTransformerhandler() method which takes SAXSource as
+     * argument can be set to XMLReader. SAXSource has input XML file as its
+     * input source. XMLReader has a transformer handler which write out the
+     * result to output file. Test verifies output file is same as golden file.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "saxtf001.out";
+        String goldFile = GOLDEN_DIR + "saxtf001GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory) TransformerFactory.newInstance();
+            TransformerHandler handler = saxTFactory.newTransformerHandler(new StreamSource(XSLT_FILE));
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * SAXTFactory.newTransformerhandler() method which takes SAXSource as
+     * argument can be set to XMLReader. SAXSource has input XML file as its
+     * input source. XMLReader has a content handler which write out the result
+     * to output file. Test verifies output file is same as golden file.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase02() throws Exception {
+        String outputFile = USER_DIR + "saxtf002.out";
+        String goldFile = GOLDEN_DIR + "saxtf002GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile);
+                FileInputStream fis = new FileInputStream(XSLT_FILE)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory) TransformerFactory.newInstance();
+            SAXSource ss = new SAXSource();
+            ss.setInputSource(new InputSource(fis));
+
+            TransformerHandler handler = saxTFactory.newTransformerHandler(ss);
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test for newTransformerhandler(Source). DcoumentBuilderFactory is
+     * namespace awareness, DocumentBuilder parse xslt file as DOMSource.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase03() throws Exception {
+        String outputFile = USER_DIR + "saxtf003.out";
+        String goldFile = GOLDEN_DIR + "saxtf003GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document document = docBuilder.parse(new File(XSLT_FILE));
+            Node node = (Node)document;
+            DOMSource domSource= new DOMSource(node);
+
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+            TransformerHandler handler =
+                        saxTFactory.newTransformerHandler(domSource);
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Negative test for newTransformerHandler when relative URI is in XML file.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test(expectedExceptions = TransformerConfigurationException.class)
+    public void transformerHandlerTest04() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        Document document = docBuilder.parse(new File(XSLT_INCL_FILE));
+        DOMSource domSource= new DOMSource(document);
+        SAXTransformerFactory saxTFactory
+                = (SAXTransformerFactory)TransformerFactory.newInstance();
+        saxTFactory.newTransformerHandler(domSource);
+    }
+
+    /**
+     * Unit test for XMLReader parsing when relative URI is used in xsl file and
+     * SystemId was set.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase05() throws Exception {
+        String outputFile = USER_DIR + "saxtf005.out";
+        String goldFile = GOLDEN_DIR + "saxtf005GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document document = docBuilder.parse(new File(XSLT_INCL_FILE));
+            Node node = (Node)document;
+            DOMSource domSource= new DOMSource(node);
+
+            domSource.setSystemId("file:///" + XML_DIR);
+
+            TransformerHandler handler =
+                        saxTFactory.newTransformerHandler(domSource);
+            Result result = new StreamResult(fos);
+
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test newTransformerHandler with a DOMSource.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase06() throws Exception {
+        String outputFile = USER_DIR + "saxtf006.out";
+        String goldFile = GOLDEN_DIR + "saxtf006GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Node node = (Node)docBuilder.parse(new File(XSLT_INCL_FILE));
+
+            DOMSource domSource = new DOMSource(node, "file:///" + XML_DIR);
+            TransformerHandler handler =
+                        saxTFactory.newTransformerHandler(domSource);
+
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Test newTransformerHandler with a Template Handler.
+     *
+     * @throws Exception If any errors occur.
+     */
+    public void testcase08() throws Exception {
+        String outputFile = USER_DIR + "saxtf008.out";
+        String goldFile = GOLDEN_DIR + "saxtf008GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+
+            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
+            reader.setContentHandler(thandler);
+            reader.parse(XSLT_FILE);
+            TransformerHandler tfhandler
+                    = saxTFactory.newTransformerHandler(thandler.getTemplates());
+
+            Result result = new StreamResult(fos);
+            tfhandler.setResult(result);
+
+            reader.setContentHandler(tfhandler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Test newTransformerHandler with a Template Handler along with a relative
+     * URI in the style-sheet file.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase09() throws Exception {
+        String outputFile = USER_DIR + "saxtf009.out";
+        String goldFile = GOLDEN_DIR + "saxtf009GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+
+            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
+            thandler.setSystemId("file:///" + XML_DIR);
+            reader.setContentHandler(thandler);
+            reader.parse(XSLT_INCL_FILE);
+            TransformerHandler tfhandler=
+                saxTFactory.newTransformerHandler(thandler.getTemplates());
+            Result result = new StreamResult(fos);
+            tfhandler.setResult(result);
+            reader.setContentHandler(tfhandler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test for contentHandler setter/getter along reader as handler's
+     * parent.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase10() throws Exception {
+        String outputFile = USER_DIR + "saxtf010.out";
+        String goldFile = GOLDEN_DIR + "saxtf010GF.out";
+        // The transformer will use a SAX parser as it's reader.
+        XMLReader reader = XMLReaderFactory.createXMLReader();
+        SAXTransformerFactory saxTFactory
+                = (SAXTransformerFactory)TransformerFactory.newInstance();
+        XMLFilter filter =
+            saxTFactory.newXMLFilter(new StreamSource(XSLT_FILE));
+        filter.setParent(reader);
+        filter.setContentHandler(new MyContentHandler(outputFile));
+
+        // Now, when you call transformer.parse, it will set itself as
+        // the content handler for the parser object (it's "parent"), and
+        // will then call the parse method on the parser.
+        filter.parse(new InputSource(XML_FILE));
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test for contentHandler setter/getter with parent.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase11() throws Exception {
+        String outputFile = USER_DIR + "saxtf011.out";
+        String goldFile = GOLDEN_DIR + "saxtf011GF.out";
+        // The transformer will use a SAX parser as it's reader.
+        XMLReader reader = XMLReaderFactory.createXMLReader();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        Document document = docBuilder.parse(new File(XSLT_FILE));
+        Node node = (Node)document;
+        DOMSource domSource= new DOMSource(node);
+
+        SAXTransformerFactory saxTFactory
+                = (SAXTransformerFactory)TransformerFactory.newInstance();
+        XMLFilter filter = saxTFactory.newXMLFilter(domSource);
+
+        filter.setParent(reader);
+        filter.setContentHandler(new MyContentHandler(outputFile));
+
+        // Now, when you call transformer.parse, it will set itself as
+        // the content handler for the parser object (it's "parent"), and
+        // will then call the parse method on the parser.
+        filter.parse(new InputSource(XML_FILE));
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test for contentHandler setter/getter.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase12() throws Exception {
+        String outputFile = USER_DIR + "saxtf012.out";
+        String goldFile = GOLDEN_DIR + "saxtf012GF.out";
+        // The transformer will use a SAX parser as it's reader.
+        XMLReader reader = XMLReaderFactory.createXMLReader();
+
+        InputSource is = new InputSource(new FileInputStream(XSLT_FILE));
+        SAXSource saxSource = new SAXSource();
+        saxSource.setInputSource(is);
+
+        SAXTransformerFactory saxTFactory = (SAXTransformerFactory)TransformerFactory.newInstance();
+        XMLFilter filter = saxTFactory.newXMLFilter(saxSource);
+
+        filter.setParent(reader);
+        filter.setContentHandler(new MyContentHandler(outputFile));
+
+        // Now, when you call transformer.parse, it will set itself as
+        // the content handler for the parser object (it's "parent"), and
+        // will then call the parse method on the parser.
+        filter.parse(new InputSource(XML_FILE));
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test for TemplatesHandler setter/getter.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase13() throws Exception {
+        String outputFile = USER_DIR + "saxtf013.out";
+        String goldFile = GOLDEN_DIR + "saxtf013GF.out";
+        try(FileInputStream fis = new FileInputStream(XML_FILE)) {
+            // The transformer will use a SAX parser as it's reader.
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory) TransformerFactory.newInstance();
+            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
+            // I have put this as it was complaining about systemid
+            thandler.setSystemId("file:///" + USER_DIR);
+
+            reader.setContentHandler(thandler);
+            reader.parse(XSLT_FILE);
+            XMLFilter filter
+                    = saxTFactory.newXMLFilter(thandler.getTemplates());
+            filter.setParent(reader);
+
+            filter.setContentHandler(new MyContentHandler(outputFile));
+            filter.parse(new InputSource(fis));
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest001.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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 javax.xml.transform.ptests;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-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 static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerhandler() method which takes StreamSource as argument can
- * be set to XMLReader.
- */
-public class SAXTFactoryTest001 {
-    /**
-     * SAXTFactory.newTransformerhandler() method which takes SAXSource as
-     * argument can be set to XMLReader. SAXSource has input XML file as its
-     * input source. XMLReader has a transformer handler which write out the
-     * result to output file. Test verifies output file is same as golden file.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf001.out";
-        String goldFile = GOLDEN_DIR + "saxtf001GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory) TransformerFactory.newInstance();
-            TransformerHandler handler = saxTFactory.newTransformerHandler(
-                    new StreamSource(xsltFile));
-            Result result = new StreamResult(fos);
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | TransformerConfigurationException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest002.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +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 javax.xml.transform.ptests;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-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 javax.xml.transform.stream.StreamResult;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerhandler() method which takes SAXSource as argument can
- * be set to XMLReader.
- */
-public class SAXTFactoryTest002 {
-    /**
-     * SAXTFactory.newTransformerhandler() method which takes SAXSource as
-     * argument can be set to XMLReader. SAXSource has input XML file as its
-     * input source. XMLReader has a content handler which write out the result
-     * to output file. Test verifies output file is same as golden file.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf002.out";
-        String goldFile = GOLDEN_DIR + "saxtf002GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile);
-                FileInputStream fis = new FileInputStream(xsltFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory) TransformerFactory.newInstance();
-            SAXSource ss = new SAXSource();
-            ss.setInputSource(new InputSource(fis));
-
-            TransformerHandler handler = saxTFactory.newTransformerHandler(ss);
-            Result result = new StreamResult(fos);
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest003.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +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 javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-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.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerhandler() method which takes DOMSource as argument can
- * be set to XMLReader.
- */
-public class SAXTFactoryTest003 {
-    /**
-     * Unit test for newTransformerhandler(Source). DcoumentBuilderFactory is
-     * namespace awareness, DocumentBuilder parse xslt file as DOMSource.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf003.out";
-        String goldFile = GOLDEN_DIR + "saxtf003GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document document = docBuilder.parse(new File(xsltFile));
-            Node node = (Node)document;
-            DOMSource domSource= new DOMSource(node);
-
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-            TransformerHandler handler =
-                        saxTFactory.newTransformerHandler(domSource);
-            Result result = new StreamResult(fos);
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (TransformerConfigurationException | ParserConfigurationException
-                | SAXException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest004.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +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 javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.IOException;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-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.SAXTransformerFactory;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/*
- * TransformerConfigurationException expected when there is relative URI is used
- * in citiesinclude.xsl file
- */
-public class SAXTFactoryTest004 {
-    /**
-     * Negative test for newTransformerHandler when relative URI is in XML file.
-     * @throws TransformerConfigurationException If for some reason the
-     * TransformerHandler can not be created.
-     */
-    @Test(expectedExceptions = TransformerConfigurationException.class)
-    public void transformerHandlerTest01() throws TransformerConfigurationException {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document document = docBuilder.parse(new File(XML_DIR + "citiesinclude.xsl"));
-            DOMSource domSource= new DOMSource(document);
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-            saxTFactory.newTransformerHandler(domSource);
-        } catch (ParserConfigurationException | IOException | SAXException ex) {
-            failUnexpected(ex);
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest005.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +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 javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-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.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test SAXSource API when relative URI is used in xsl file and SystemId was set
- */
-public class SAXTFactoryTest005 {
-    /**
-     * Unit test for XMLReader parsing when relative URI is used in xsl file and
-     * SystemId was set.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf005.out";
-        String goldFile = GOLDEN_DIR + "saxtf005GF.out";
-        String xsltFile = XML_DIR + "citiesinclude.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document document = docBuilder.parse(new File(xsltFile));
-            Node node = (Node)document;
-            DOMSource domSource= new DOMSource(node);
-
-            domSource.setSystemId("file:///" + XML_DIR);
-
-            TransformerHandler handler =
-                        saxTFactory.newTransformerHandler(domSource);
-            Result result = new StreamResult(fos);
-
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (TransformerConfigurationException | ParserConfigurationException
-                | SAXException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest006.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +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 javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerHandler with a DOMSource and StreamResult set.
- */
-public class SAXTFactoryTest006 extends TransformerTestConst{
-    /**
-     * Unit test newTransformerHandler with a DOMSource.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf006.out";
-        String goldFile = GOLDEN_DIR + "saxtf006GF.out";
-        String xsltFile = XML_DIR + "citiesinclude.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Node node = (Node)docBuilder.parse(new File(xsltFile));
-
-            DOMSource domSource = new DOMSource(node, "file:///" + XML_DIR);
-            TransformerHandler handler =
-                        saxTFactory.newTransformerHandler(domSource);
-
-            Result result = new StreamResult(fos);
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (TransformerConfigurationException | ParserConfigurationException
-                | SAXException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest008.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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 javax.xml.transform.ptests;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-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 static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerHandler with a Template Handler.
- */
-public class SAXTFactoryTest008 {
-    /**
-     * Test newTransformerHandler with a Template Handler.
-     */
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf008.out";
-        String goldFile = GOLDEN_DIR + "saxtf008GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-
-            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
-            reader.setContentHandler(thandler);
-            reader.parse(xsltFile);
-            TransformerHandler tfhandler
-                    = saxTFactory.newTransformerHandler(thandler.getTemplates());
-
-            Result result = new StreamResult(fos);
-            tfhandler.setResult(result);
-
-            reader.setContentHandler(tfhandler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-  }
-
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest009.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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 javax.xml.transform.ptests;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-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 static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerHandler with a Template Handler along with a relative URI
- * in the xslt file.
- */
-public class SAXTFactoryTest009 {
-    /**
-     * Test newTransformerHandler with a Template Handler along with a relative
-     * URI in the xslt file.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf009.out";
-        String goldFile = GOLDEN_DIR + "saxtf009GF.out";
-        String xsltFile = XML_DIR + "citiesinclude.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-
-            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
-            thandler.setSystemId("file:///" + XML_DIR);
-            reader.setContentHandler(thandler);
-            reader.parse(xsltFile);
-            TransformerHandler tfhandler=
-                saxTFactory.newTransformerHandler(thandler.getTemplates());
-            Result result = new StreamResult(fos);
-            tfhandler.setResult(result);
-            reader.setContentHandler(tfhandler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-  }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest010.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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 javax.xml.transform.ptests;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLFilter;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test XMLFilter parse InputSource along with customized ContentHandler.
- */
-public class SAXTFactoryTest010 {
-    /**
-     * Unit test for contentHandler setter/getter along reader as handler's
-     * parent.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf010.out";
-        String goldFile = GOLDEN_DIR + "saxtf010GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try {
-            // The transformer will use a SAX parser as it's reader.
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-            XMLFilter filter =
-                saxTFactory.newXMLFilter(new StreamSource(xsltFile));
-
-            filter.setParent(reader);
-            filter.setContentHandler(new MyContentHandler(outputFile));
-
-            // Now, when you call transformer.parse, it will set itself as
-            // the content handler for the parser object (it's "parent"), and
-            // will then call the parse method on the parser.
-            filter.parse(new InputSource(xmlFile));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest011.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +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 javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLFilter;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test XMLFilter parse InputSource along with customized ContentHandler by
- * using SAX parser as it's reader.
- */
-public class SAXTFactoryTest011 {
-    /**
-     * Unit test for contentHandler setter/getter with parent.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf011.out";
-        String goldFile = GOLDEN_DIR + "saxtf011GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try {
-            // The transformer will use a SAX parser as it's reader.
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document document = docBuilder.parse(new File(xsltFile));
-            Node node = (Node)document;
-            DOMSource domSource= new DOMSource(node);
-
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-            XMLFilter filter = saxTFactory.newXMLFilter(domSource);
-
-            filter.setParent(reader);
-            filter.setContentHandler(new MyContentHandler(outputFile));
-
-            // Now, when you call transformer.parse, it will set itself as
-            // the content handler for the parser object (it's "parent"), and
-            // will then call the parse method on the parser.
-            filter.parse(new InputSource(xmlFile));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException
-                | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest012.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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 javax.xml.transform.ptests;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-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 static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLFilter;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test XMLFilter parse InputSource along with customized ContentHandler by
- * using SAX parser as it's reader.
- */
-public class SAXTFactoryTest012 {
-    /**
-     * Unit test for contentHandler setter/getter.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf012.out";
-        String goldFile = GOLDEN_DIR + "saxtf012GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-        try {
-            // The transformer will use a SAX parser as it's reader.
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-
-            InputSource is = new InputSource(new FileInputStream(xsltFile));
-            SAXSource saxSource = new SAXSource();
-            saxSource.setInputSource(is);
-
-            SAXTransformerFactory saxTFactory = (SAXTransformerFactory)TransformerFactory.newInstance();
-            XMLFilter filter = saxTFactory.newXMLFilter(saxSource);
-
-            filter.setParent(reader);
-            filter.setContentHandler(new MyContentHandler(outputFile));
-
-            // Now, when you call transformer.parse, it will set itself as
-            // the content handler for the parser object (it's "parent"), and
-            // will then call the parse method on the parser.
-            filter.parse(new InputSource(xmlFile));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest013.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +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 javax.xml.transform.ptests;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TemplatesHandler;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLFilter;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test XMLFilter parse InputSource along with TemplatesHandler.
- */
-public class SAXTFactoryTest013 {
-    /**
-     * Unit test for TemplatesHandler setter/getter.
-     */
-    @Test
-    public  void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf013.out";
-        String goldFile = GOLDEN_DIR + "saxtf013GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try {
-            // The transformer will use a SAX parser as it's reader.
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory) TransformerFactory.newInstance();
-            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
-            // I have put this as it was complaining about systemid
-            thandler.setSystemId("file:///" + CLASS_DIR);
-
-            reader.setContentHandler(thandler);
-            reader.parse(xsltFile);
-            XMLFilter filter
-                    = saxTFactory.newXMLFilter(thandler.getTemplates());
-            filter.setParent(reader);
-
-            filter.setContentHandler(
-                    new MyContentHandler(outputFile));
-            filter.parse(new InputSource(new FileInputStream(xmlFile)));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2003, 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 javax.xml.transform.ptests;
+
+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;
+import javax.xml.transform.Transformer;
+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.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * Test a StreamResult using a file name that contains URL characters that need
+ * to be encoded.
+ */
+public class StreamResultTest extends JAXPFileBaseTest {
+    /**
+     * Unit test for StreamResult.
+     */
+    @Test
+    public void testcase01() {
+        // Set Transformer properties
+        Properties transformProperties = new Properties();
+        transformProperties.put("method", "xml");
+        transformProperties.put("encoding", "UTF-8");
+        transformProperties.put("omit-xml-declaration", "yes");
+        transformProperties.put("{http://xml.apache.org/xslt}indent-amount", "0");
+        transformProperties.put("indent", "no");
+        transformProperties.put("standalone", "no");
+        transformProperties.put("version", "1.0");
+        transformProperties.put("media-type", "text/xml");
+
+        String[] fileNames = {
+            "StreamResult01.out",
+            "StreamResult 02.out",
+            "StreamResult#03.out"
+        };
+
+        String xslFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        Arrays.stream(fileNames).forEach(file -> {
+            try {
+                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+                dbf.setNamespaceAware(true);
+                DocumentBuilder db = dbf.newDocumentBuilder();
+                Document document = db.parse(new File(xslFile));
+                DOMSource domSource = new DOMSource(document);
+                StreamSource streamSource = new StreamSource(new FileInputStream(xmlFile));
+
+                File streamResultFile = new File(USER_DIR + file);
+                StreamResult streamResult = new StreamResult(streamResultFile);
+
+                Transformer transformer = TransformerFactory.newInstance().newTransformer(domSource);
+                transformer.setOutputProperties(transformProperties);
+                transformer.transform(streamSource, streamResult);
+            } catch (SAXException | IOException | ParserConfigurationException
+                    | TransformerException ex) {
+                failUnexpected(ex);
+            }
+        });
+    }
+}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest01.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +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 javax.xml.transform.ptests;
-
-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;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * Test a StreamResult using a file name that contains URL characters that need
- * to be encoded.
- */
-public class StreamResultTest01 {
-    /**
-     * Unit test for StreamResult.
-     */
-    @Test
-    public void testcase01() {
-        // Set Transformer properties
-        Properties transformProperties = new Properties();
-        transformProperties.put("method", "xml");
-        transformProperties.put("encoding", "UTF-8");
-        transformProperties.put("omit-xml-declaration", "yes");
-        transformProperties.put("{http://xml.apache.org/xslt}indent-amount", "0");
-        transformProperties.put("indent", "no");
-        transformProperties.put("standalone", "no");
-        transformProperties.put("version", "1.0");
-        transformProperties.put("media-type", "text/xml");
-
-        String[] fileNames = {
-            "StreamResult01.out",
-            "StreamResult 02.out",
-            "StreamResult#03.out"
-        };
-
-        String xslFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        Arrays.stream(fileNames).forEach(file -> {
-            try {
-                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-                dbf.setNamespaceAware(true);
-                DocumentBuilder db = dbf.newDocumentBuilder();
-                Document document = db.parse(new File(xslFile));
-                DOMSource domSource = new DOMSource(document);
-                StreamSource streamSource = new StreamSource(new FileInputStream(xmlFile));
-
-                File streamResultFile = new File(CLASS_DIR + file);
-                StreamResult streamResult = new StreamResult(streamResultFile);
-
-                Transformer transformer = TransformerFactory.newInstance().newTransformer(domSource);
-                transformer.setOutputProperties(transformProperties);
-                transformer.transform(streamSource, streamResult);
-            } catch (SAXException | IOException | ParserConfigurationException
-                    | TransformerException ex) {
-                failUnexpected(ex);
-            }
-        });
-    }
-}
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,11 +24,8 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
 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.TransformerFactory;
@@ -36,21 +33,20 @@
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * Class containing the test cases for SAXParserFactory API
  */
-public class TfClearParamTest {
+public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
     /**
-     * Test xslt file.
+     * Test style-sheet file name.
      */
     private final String XSL_FILE = XML_DIR + "cities.xsl";
 
@@ -72,193 +68,164 @@
     /**
      * Obtains transformer's parameter with the same name that set before. Value
      * should be same as set one.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
      */
     @Test
-    public void clear01() {
-        try {
-            Transformer transformer = TransformerFactory.newInstance().newTransformer();
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            assertEquals(transformer.getParameter(LONG_PARAM_NAME).toString(), PARAM_VALUE);
-        } catch (TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        }
-
+    public void clear01() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        assertEquals(transformer.getParameter(LONG_PARAM_NAME).toString(), PARAM_VALUE);
     }
 
     /**
      * Obtains transformer's parameter with the a name that wasn't set before.
      * Null is expected.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
      */
     @Test
-    public void clear02() {
-        try {
-            Transformer transformer = TransformerFactory.newInstance().newTransformer();
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            transformer.clearParameters();
-            assertNull(transformer.getParameter(LONG_PARAM_NAME));
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
+    public void clear02() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        transformer.clearParameters();
+        assertNull(transformer.getParameter(LONG_PARAM_NAME));
+    }
+
+    /**
+     * Obtains transformer's parameter with a short name that set before. Value
+     * should be same as set one.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
+     */
+    @Test
+    public void clear03() throws TransformerConfigurationException {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        Transformer transformer = tfactory.newTransformer();
+
+        transformer.setParameter(SHORT_PARAM_NAME, PARAM_VALUE);
+        assertEquals(transformer.getParameter(SHORT_PARAM_NAME).toString(), PARAM_VALUE);
+    }
+
+    /**
+     * Obtains transformer's parameter with a short name that set with an integer
+     * object before. Value should be same as the set integer object.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
+     */
+    @Test
+    public void clear04() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+
+        int intObject = 5;
+        transformer.setParameter(SHORT_PARAM_NAME, intObject);
+        assertEquals(transformer.getParameter(SHORT_PARAM_NAME), intObject);
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a stream source with
      * the a name that set before. Value should be same as set one.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
      */
-    @Test
-    public void clear03() {
-        try {
-            Transformer transformer = TransformerFactory.newInstance().
-                    newTransformer(new StreamSource(new File(XSL_FILE)));
+    @Test (groups = {"readLocalFiles"})
+    public void clear05() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().
+                newTransformer(new StreamSource(new File(XSL_FILE)));
 
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a stream source with
      * the a name that wasn't set before. Null is expected.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
      */
-    @Test
-    public void clear04() {
-        try {
-            Transformer transformer = TransformerFactory.newInstance().
-                    newTransformer(new StreamSource(new File(XSL_FILE)));
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            transformer.clearParameters();
-            assertNull(transformer.getParameter(LONG_PARAM_NAME));
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
-
+    @Test (groups = {"readLocalFiles"})
+    public void clear06() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().
+                newTransformer(new StreamSource(new File(XSL_FILE)));
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        transformer.clearParameters();
+        assertNull(transformer.getParameter(LONG_PARAM_NAME));
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a sax source with
      * the a name that set before. Value should be same as set one.
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void clear05() {
-        try {
-            InputSource is = new InputSource(new FileInputStream(XSL_FILE));
+    @Test (groups = {"readLocalFiles"})
+    public void clear07() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
             SAXSource saxSource = new SAXSource();
-            saxSource.setInputSource(is);
+            saxSource.setInputSource(new InputSource(fis));
 
             Transformer transformer = TransformerFactory.newInstance().newTransformer(saxSource);
-
             transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
             assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
-        } catch (FileNotFoundException | TransformerConfigurationException ex){
-            failUnexpected(ex);
         }
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a sax source with
      * the a name that wasn't set before. Null is expected.
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void clear06() {
-        try {
-            InputSource is = new InputSource(new FileInputStream(XSL_FILE));
+    @Test (groups = {"readLocalFiles"})
+    public void clear08() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
             SAXSource saxSource = new SAXSource();
-            saxSource.setInputSource(is);
+            saxSource.setInputSource(new InputSource(fis));
 
             Transformer transformer = TransformerFactory.newInstance().newTransformer(saxSource);
-
             transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
             transformer.clearParameters();
             assertNull(transformer.getParameter(LONG_PARAM_NAME));
-        } catch (FileNotFoundException | TransformerConfigurationException ex){
-            failUnexpected(ex);
         }
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a dom source with
      * the a name that set before. Value should be same as set one.
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void clear07() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
+    @Test (groups = {"readLocalFiles"})
+    public void clear09() throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
 
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(XSL_FILE));
-            DOMSource domSource = new DOMSource((Node)document);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(XSL_FILE));
+        DOMSource domSource = new DOMSource((Node)document);
 
-            Transformer transformer = tfactory.newTransformer(domSource);
+        Transformer transformer = tfactory.newTransformer(domSource);
 
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
-        } catch (IOException | ParserConfigurationException
-                | TransformerConfigurationException | SAXException ex){
-            failUnexpected(ex);
-        }
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a dom source with
      * the a name that wasn't set before. Null is expected.
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void clear08() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
+    @Test (groups = {"readLocalFiles"})
+    public void clear10() throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
 
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(XSL_FILE));
-            DOMSource domSource = new DOMSource((Node)document);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(XSL_FILE));
+        DOMSource domSource = new DOMSource((Node)document);
 
-            Transformer transformer = tfactory.newTransformer(domSource);
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            transformer.clearParameters();
-            assertNull(transformer.getParameter(LONG_PARAM_NAME));
-        } catch (IOException | ParserConfigurationException
-                | TransformerConfigurationException | SAXException ex){
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Obtains transformer's parameter with a short name that set before. Value
-     * should be same as set one.
-     */
-    @Test
-    public void clear09() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            Transformer transformer = tfactory.newTransformer();
-
-            transformer.setParameter(SHORT_PARAM_NAME, PARAM_VALUE);
-            assertEquals(transformer.getParameter(SHORT_PARAM_NAME).toString(), PARAM_VALUE);
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Obtains transformer's parameter with a short name that set with an integer
-     * object before. Value should be same as the set integer object.
-     */
-    @Test
-    public void clear10() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            Transformer transformer = tfactory.newTransformer();
-
-            int intObject = 5;
-            transformer.setParameter(SHORT_PARAM_NAME, intObject);
-            assertEquals(transformer.getParameter(SHORT_PARAM_NAME), intObject);
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
+        Transformer transformer = tfactory.newTransformer(domSource);
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        transformer.clearParameters();
+        assertNull(transformer.getParameter(LONG_PARAM_NAME));
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,12 +23,14 @@
 package javax.xml.transform.ptests;
 
 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;
@@ -38,13 +40,14 @@
 /**
  *  Basic test for TransformerException specification.
  */
-public class TransformerExcpTest {
+public class TransformerExcpTest extends JAXPBaseTest {
     /**
-     * Transform an unformatted xslt file. TransformerException is thrown.
+     * 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
@@ -60,6 +63,8 @@
             assertNotNull(e.getException());
             assertNull(e.getLocationAsString());
             assertEquals(e.getMessageAndLocation(),e.getMessage());
+        } finally {
+            setPermissions();
         }
     }
 
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,39 +24,35 @@
 
 import java.io.*;
 import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import javax.xml.parsers.*;
 import javax.xml.transform.*;
 import javax.xml.transform.dom.*;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
 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.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
 import org.w3c.dom.*;
-import org.xml.sax.SAXException;
 
 /**
  * Class containing the test cases for TransformerFactory API's
  * getAssociatedStyleSheet method.
  */
-public class TransformerFactoryTest {
+public class TransformerFactoryTest extends JAXPFileBaseTest {
     /**
      * This test case checks for the getAssociatedStylesheet method
      * of TransformerFactory.
      * The style sheet returned is then copied to an tfactory01.out
-     * It will then be verified to see if it matches the golden files
+     * It will then be verified to see if it matches the golden files.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void tfactory01() {
-        String outputFile = CLASS_DIR + "tfactory01.out";
+    public void tfactory01() throws Exception {
+        String outputFile = USER_DIR + "tfactory01.out";
         String goldFile = GOLDEN_DIR + "tfactory01GF.out";
         String xmlFile = XML_DIR + "TransformerFactoryTest.xml";
         String xmlURI = "file:///" + XML_DIR;
@@ -76,10 +72,7 @@
                                            "Modern", null);
             Transformer t = tFactory.newTransformer();
             t.transform(s, streamResult);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException | ParserConfigurationException
-                | TransformerException | SAXException ex) {
-            failUnexpected(ex);
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,12 +24,9 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
 import java.util.Properties;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerConfigurationException;
@@ -39,150 +36,132 @@
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+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.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * Basic test cases for Transformer API
  */
-public class TransformerTest {
+public class TransformerTest extends JAXPFileReadOnlyBaseTest {
     /**
      * XSLT file serves every test method.
      */
     private final static String TEST_XSL = XML_DIR + "cities.xsl";
 
     /**
-     * This tests if newTransformer(StreamSource) method returns Transformer
+     * This tests if newTransformer(StreamSource) method returns Transformer.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
      */
-    @Test
-    public void transformer01() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public void transformer01() throws TransformerConfigurationException {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        StreamSource streamSource = new StreamSource(
+                                    new File(TEST_XSL));
+        Transformer transformer = tfactory.newTransformer(streamSource);
+        assertNotNull(transformer);
+    }
+
+    /**
+     * This tests if newTransformer(SAXSource) method returns Transformer.
+     * @throws Exception If any errors occur.
+     */
+    @Test (groups = {"readLocalFiles"})
+    public void transformer02() throws Exception {
+        try (FileInputStream fis = new FileInputStream(TEST_XSL)) {
             TransformerFactory tfactory = TransformerFactory.newInstance();
-            StreamSource streamSource = new StreamSource(
-                                        new File(TEST_XSL));
-            Transformer transformer = tfactory.newTransformer(streamSource);
+            SAXSource saxSource = new SAXSource(new InputSource(fis));
+            Transformer transformer = tfactory.newTransformer(saxSource);
             assertNotNull(transformer);
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
         }
     }
 
     /**
-     * This tests if newTransformer(SAXSource) method returns Transformer
+     * This tests if newTransformer(DOMSource) method returns Transformer.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void transformer02() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            InputSource is = new InputSource(
-                        new FileInputStream(TEST_XSL));
-            SAXSource saxSource = new SAXSource(is);
-            Transformer transformer = tfactory.newTransformer(saxSource);
-            assertNotNull(transformer);
-        } catch (TransformerConfigurationException | FileNotFoundException ex){
-            failUnexpected(ex);
-        }
+    @Test (groups = {"readLocalFiles"})
+    public void transformer03() throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(TEST_XSL));
+        DOMSource domSource = new DOMSource(document);
+
+        Transformer transformer = tfactory.newTransformer(domSource);
+        assertNotNull(transformer);
     }
 
     /**
-     * This tests if newTransformer(DOMSource) method returns Transformer
+     * This tests set/get ErrorListener methods of Transformer.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void transformer03() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
+    @Test (groups = {"readLocalFiles"})
+    public void transformer04() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(TEST_XSL));
+        DOMSource domSource = new DOMSource(document);
 
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(TEST_XSL));
-            DOMSource domSource = new DOMSource(document);
-
-            Transformer transformer = tfactory.newTransformer(domSource);
-            assertNotNull(transformer);
-        } catch (TransformerConfigurationException | IOException
-                | ParserConfigurationException | SAXException ex){
-            failUnexpected(ex);
-        }
+        Transformer transformer = TransformerFactory.newInstance()
+                .newTransformer(domSource);
+        transformer.setErrorListener(new MyErrorListener());
+        assertNotNull(transformer.getErrorListener());
+        assertTrue(transformer.getErrorListener() instanceof MyErrorListener);
     }
 
     /**
-     * This tests set/get ErrorListener methods of Transformer
+     * This tests getOutputProperties() method of Transformer.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void transformer04() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(TEST_XSL));
-            DOMSource domSource = new DOMSource(document);
+    @Test (groups = {"readLocalFiles"})
+    public void transformer05() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(TEST_XSL));
+        DOMSource domSource = new DOMSource(document);
 
-            Transformer transformer = TransformerFactory.newInstance()
-                    .newTransformer(domSource);
-            transformer.setErrorListener(new MyErrorListener());
-            assertNotNull(transformer.getErrorListener());
-            assertTrue(transformer.getErrorListener() instanceof MyErrorListener);
-        } catch (IOException | IllegalArgumentException | ParserConfigurationException
-                | TransformerConfigurationException | SAXException ex){
-            failUnexpected(ex);
-        }
+        Transformer transformer = TransformerFactory.newInstance().
+                newTransformer(domSource);
+        Properties prop = transformer.getOutputProperties();
+
+        assertEquals(prop.getProperty("indent"), "yes");
+        assertEquals(prop.getProperty("method"), "xml");
+        assertEquals(prop.getProperty("encoding"), "UTF-8");
+        assertEquals(prop.getProperty("standalone"), "no");
+        assertEquals(prop.getProperty("version"), "1.0");
+        assertEquals(prop.getProperty("omit-xml-declaration"), "no");
     }
 
     /**
-     * This tests getOutputProperties() method of Transformer
+     * This tests getOutputProperty() method of Transformer.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void transformer05() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(TEST_XSL));
-            DOMSource domSource = new DOMSource(document);
+    @Test (groups = {"readLocalFiles"})
+    public void transformer06() throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
 
-            Transformer transformer = TransformerFactory.newInstance().
-                    newTransformer(domSource);
-            Properties prop = transformer.getOutputProperties();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(TEST_XSL));
+        DOMSource domSource = new DOMSource(document);
 
-            assertEquals(prop.getProperty("indent"), "yes");
-            assertEquals(prop.getProperty("method"), "xml");
-            assertEquals(prop.getProperty("encoding"), "UTF-8");
-            assertEquals(prop.getProperty("standalone"), "no");
-            assertEquals(prop.getProperty("version"), "1.0");
-            assertEquals(prop.getProperty("omit-xml-declaration"), "no");
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * This tests getOutputProperty() method of Transformer
-     */
-    @Test
-    public void transformer06() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(TEST_XSL));
-            DOMSource domSource = new DOMSource(document);
-
-            Transformer transformer = tfactory.newTransformer(domSource);
-            assertEquals(transformer.getOutputProperty("method"), "xml");
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerConfigurationException | IllegalArgumentException ex){
-            failUnexpected(ex);
-        }
+        Transformer transformer = tfactory.newTransformer(domSource);
+        assertEquals(transformer.getOutputProperty("method"), "xml");
     }
 }
 
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -25,42 +25,34 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
 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 jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
 
 
 /**
  * Here a transformer is created using DOMSource. Some specific output property
  * is set on transformer. Then transform(StreamSource, StreamResult) is tested.
  */
-public class TransformerTest02 {
+public class TransformerTest02 extends JAXPFileBaseTest {
     /**
      * Unit test for transform(StreamSource, StreamResult).
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "transformer02.out";
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "transformer02.out";
         String goldFile = GOLDEN_DIR + "transformer02GF.out";
         String xsltFile = XML_DIR + "cities.xsl";
         String xmlFile = XML_DIR + "cities.xml";
@@ -69,9 +61,8 @@
                 FileOutputStream fos = new FileOutputStream(outputFile)) {
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
             dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(xsltFile));
-            DOMSource domSource = new DOMSource(document);
+            DOMSource domSource = new DOMSource(dbf.newDocumentBuilder().
+                    parse(new File(xsltFile)));
 
             Transformer transformer = TransformerFactory.newInstance().
                     newTransformer(domSource);
@@ -79,20 +70,8 @@
             StreamResult streamResult = new StreamResult(fos);
 
             transformer.setOutputProperty("indent", "no");
-            transformer.transform( streamSource, streamResult);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException | IllegalArgumentException
-                | ParserConfigurationException | TransformerException
-                | SAXException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
+            transformer.transform(streamSource, streamResult);
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -25,30 +25,20 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Properties;
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
 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 jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
 
 /**
  * Here Properties Object is populated with required properties.A transformer
@@ -56,13 +46,15 @@
  * for transformer. Then transform(StreamSource, StreamResult) is used for
  * transformation. This tests the setOutputProperties() method.
  */
-public class TransformerTest03 {
+public class TransformerTest03 extends JAXPFileBaseTest {
     /**
      * Test for Transformer.setOutputProperties method.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "transformer03.out";
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "transformer03.out";
         String goldFile = GOLDEN_DIR + "transformer03GF.out";
         String xsltFile = XML_DIR + "cities.xsl";
         String xmlFile = XML_DIR + "cities.xml";
@@ -81,29 +73,14 @@
 
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
             dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(xsltFile));
-            DOMSource domSource = new DOMSource(document);
+            DOMSource domSource = new DOMSource(dbf.newDocumentBuilder().
+                    parse(new File(xsltFile)));
 
             Transformer transformer = TransformerFactory.newInstance().
                     newTransformer(domSource);
-            StreamSource streamSource = new StreamSource(fis);
-            StreamResult streamResult = new StreamResult(fos);
-
             transformer.setOutputProperties(properties);
-            transformer.transform( streamSource, streamResult);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (ParserConfigurationException | SAXException
-                | IOException | TransformerException ex){
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
+            transformer.transform(new StreamSource(fis), new StreamResult(fos));
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,15 +24,10 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Source;
 import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.URIResolver;
 import javax.xml.transform.dom.DOMSource;
@@ -40,18 +35,17 @@
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileBaseTest;
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * URIResolver should be invoked when transform happens.
  */
-public class URIResolverTest implements URIResolver {
+public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
     /**
      * System ID constant.
      */
@@ -72,9 +66,8 @@
      */
     private final static String XSL_TEMP_FILE = "temp/cities.xsl";
 
-
     /**
-     * expected Href.
+     * expected HREF.
      */
     private final String validateHref;
 
@@ -84,6 +77,14 @@
     private final String validateBase;
 
     /**
+     * Default constructor for testng invocation.
+     */
+    public URIResolverTest(){
+        validateHref = null;
+        validateBase = null;
+    }
+
+    /**
      * Constructor for setting expected Href and expected Base URI.
      * @param validateHref expected Href
      * @param validateBase expected Base URI
@@ -110,166 +111,144 @@
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using StreamSource. xsl file has xsl:include in it
+     * created using StreamSource. style-sheet file has xsl:include in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver01() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver01() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)) {
             TransformerFactory tfactory = TransformerFactory.newInstance();
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
             tfactory.setURIResolver(resolver);
 
-            StreamSource streamSource = new StreamSource(new FileInputStream(XSL_INCLUDE_FILE));
+            StreamSource streamSource = new StreamSource(fis);
             streamSource.setSystemId(SYSTEM_ID);
-
-            Transformer transformer = tfactory.newTransformer(streamSource);
-        } catch (FileNotFoundException | TransformerConfigurationException ex){
-            failUnexpected(ex);
+            assertNotNull(tfactory.newTransformer(streamSource));
         }
     }
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using DOMSource. xsl file has xsl:include in it
+     * created using DOMSource. style-sheet file has xsl:include in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver02() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver02() throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
+        tfactory.setURIResolver(resolver);
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(XSL_INCLUDE_FILE);
+        DOMSource domSource = new DOMSource(document, SYSTEM_ID);
+
+        assertNotNull(tfactory.newTransformer(domSource));
+    }
+
+    /**
+     * This is to test the URIResolver.resolve() method when a transformer is
+     * created using SAXSource. style-sheet file has xsl:include in it.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver03() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)){
+            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
             TransformerFactory tfactory = TransformerFactory.newInstance();
-            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
             tfactory.setURIResolver(resolver);
-
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(XSL_INCLUDE_FILE);
-            DOMSource domSource = new DOMSource(document, SYSTEM_ID);
-
-            Transformer transformer = tfactory.newTransformer(domSource);
-        } catch (IOException | ParserConfigurationException
-                | TransformerConfigurationException | SAXException ex){
-            failUnexpected(ex);
+            InputSource is = new InputSource(fis);
+            is.setSystemId(SYSTEM_ID);
+            SAXSource saxSource = new SAXSource(is);
+            assertNotNull(tfactory.newTransformer(saxSource));
         }
     }
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using SAXSource. xsl file has xsl:include in it
+     * created using StreamSource. style-sheet file has xsl:import in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver03() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver04() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)) {
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
             TransformerFactory tfactory = TransformerFactory.newInstance();
             tfactory.setURIResolver(resolver);
-            InputSource is = new InputSource(new FileInputStream(XSL_INCLUDE_FILE));
-            is.setSystemId(SYSTEM_ID);
-            SAXSource saxSource = new SAXSource(is);
-
-            Transformer transformer = tfactory.newTransformer(saxSource);
-        } catch (FileNotFoundException |  TransformerConfigurationException ex){
-            failUnexpected(ex);
+            StreamSource streamSource = new StreamSource(fis);
+            streamSource.setSystemId(SYSTEM_ID);
+            assertNotNull(tfactory.newTransformer(streamSource));
         }
     }
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using StreamSource. xsl file has xsl:import in it
+     * created using DOMSource. style-sheet file has xsl:import in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver04() {
-        try {
-            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            tfactory.setURIResolver(resolver);
-
-            StreamSource streamSource = new StreamSource(new FileInputStream(XSL_IMPORT_FILE));
-            streamSource.setSystemId(SYSTEM_ID);
-
-            Transformer transformer = tfactory.newTransformer(streamSource);
-        } catch (FileNotFoundException | TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver05() throws Exception {
+        URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        tfactory.setURIResolver(resolver);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(XSL_IMPORT_FILE));
+        DOMSource domSource = new DOMSource(document, SYSTEM_ID);
+        assertNotNull(tfactory.newTransformer(domSource));
     }
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using DOMSource. xsl file has xsl:import in it
+     * created using SAXSource. style-sheet file has xsl:import in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver05() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver06() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)){
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
             TransformerFactory tfactory = TransformerFactory.newInstance();
             tfactory.setURIResolver(resolver);
-
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(XSL_IMPORT_FILE));
-            DOMSource domSource = new DOMSource(document, SYSTEM_ID);
-
-            Transformer transformer = tfactory.newTransformer(domSource);
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
-
-    }
-
-    /**
-     * This is to test the URIResolver.resolve() method when a transformer is
-     * created using SAXSource. xsl file has xsl:import in it
-     */
-    @Test
-    public static void resolver06() {
-        try {
-            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            tfactory.setURIResolver(resolver);
-
-            InputSource is = new InputSource(new FileInputStream(XSL_IMPORT_FILE));
+            InputSource is = new InputSource(fis);
             is.setSystemId(SYSTEM_ID);
             SAXSource saxSource = new SAXSource(is);
-
-            Transformer transformer = tfactory.newTransformer(saxSource);
-        } catch (FileNotFoundException | TransformerConfigurationException ex){
-            failUnexpected(ex);
+            assertNotNull(tfactory.newTransformer(saxSource));
         }
-
     }
 
     /**
      * This is to test the URIResolver.resolve() method when there is an error
      * in the file.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void docResolver01() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public static void docResolver01() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XML_DIR + "doctest.xsl")) {
             URIResolverTest resolver = new URIResolverTest("temp/colors.xml", SYSTEM_ID);
-            TransformerFactory tfactory = TransformerFactory.newInstance();
+            StreamSource streamSource = new StreamSource(fis);
+            streamSource.setSystemId(SYSTEM_ID);
 
-            StreamSource streamSource = new StreamSource(
-                    new FileInputStream(XML_DIR + FILE_SEP + "doctest.xsl"));
-            streamSource.setSystemId(SYSTEM_ID);
-            System.err.println(streamSource.getSystemId());
-
-            Transformer transformer = tfactory.newTransformer(streamSource);
+            Transformer transformer = TransformerFactory.newInstance().newTransformer(streamSource);
             transformer.setURIResolver(resolver);
 
-            File f = new File(XML_DIR + FILE_SEP + "myFake.xml");
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder builder = factory.newDocumentBuilder();
-            Document document = builder.parse(f);
+            File f = new File(XML_DIR + "myFake.xml");
+            Document document = DocumentBuilderFactory.newInstance().
+                    newDocumentBuilder().parse(f);
 
             // Use a Transformer for output
             DOMSource source = new DOMSource(document);
-            System.err.println("Ignore the following output -- just dumping it here");
             StreamResult result = new StreamResult(System.err);
+            // No exception is expected because resolver resolve wrong URI.
             transformer.transform(source, result);
-        } catch (IOException | ParserConfigurationException | SAXException
-                | TransformerException ex) {
-            failUnexpected(ex);
         }
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,19 +23,22 @@
 package javax.xml.transform.ptests.othervm;
 
 import javax.xml.transform.*;
+import jaxp.library.JAXPBaseTest;
+import static org.testng.Assert.fail;
 import org.testng.annotations.Test;
 
 /**
  * Negative test for set invalid TransformerFactory property.
  */
-public class TFCErrorTest{
+public class TFCErrorTest  extends JAXPBaseTest {
     @Test(expectedExceptions = ClassNotFoundException.class)
     public void tfce01() throws Exception {
         try{
-            System.setProperty("javax.xml.transform.TransformerFactory","xx");
-            TransformerFactory tFactory = TransformerFactory.newInstance();
-        } catch (TransformerFactoryConfigurationError error) {
-            throw error.getException();
+            setSystemProperty("javax.xml.transform.TransformerFactory","xx");
+            TransformerFactory.newInstance();
+            fail("Expect TransformerFactoryConfigurationError here");
+        } catch (TransformerFactoryConfigurationError expected) {
+            throw expected.getException();
         }
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 package javax.xml.xpath.ptests;
 
-import java.io.IOException;
+import java.io.FilePermission;
 import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -31,7 +31,6 @@
 import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.xpath.XPath;
 import static javax.xml.xpath.XPathConstants.BOOLEAN;
 import static javax.xml.xpath.XPathConstants.NODE;
@@ -41,7 +40,7 @@
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertEquals;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
@@ -49,12 +48,11 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * Class containing the test cases for XPathExpression API.
  */
-public class XPathExpressionTest {
+public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
     /**
      * Document object for testing XML file.
      */
@@ -87,13 +85,11 @@
 
     /**
      * Create Document object and XPath object for every time
-     * @throws ParserConfigurationException If the factory class cannot be
-     *                                      loaded, instantiated
-     * @throws SAXException If any parse errors occur.
-     * @throws IOException If operation on xml file failed.
+     * @throws Exception If any errors occur.
      */
     @BeforeTest
-    public void setup() throws ParserConfigurationException, SAXException, IOException {
+    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();
     }
@@ -101,230 +97,200 @@
     /**
      * Test for evaluate(java.lang.Object item,QName returnType)throws
      * XPathExpressionException.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression01() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_A).
-                    evaluate(document, STRING), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression01() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_A).
+                evaluate(document, STRING), "6");
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) throws NPE if input
      * source is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression02() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(null, STRING);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression02() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(null, STRING);
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) throws NPE if returnType
      * is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression03() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(document, null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression03() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(document, null);
     }
 
     /**
      * Test for method evaluate(java.lang.Object item,QName returnType).If a
      * request is made to evaluate the expression in the absence of a context
      * item, simple expressions, such as "1+1", can be evaluated.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression04() {
-        try {
-            assertEquals(xpath.compile("1+1").evaluate(document, STRING), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression04() throws XPathExpressionException {
+        assertEquals(xpath.compile("1+1").evaluate(document, STRING), "2");
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) throws IAE If returnType
      * is not one of the types defined in XPathConstants.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testCheckXPathExpression05() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(document, TEST_QNAME);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression05() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(document, TEST_QNAME);
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) return correct boolean
      * value if returnType is Boolean.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression06() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_A).
+    public void testCheckXPathExpression06() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_A).
                 evaluate(document, BOOLEAN), true);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) return correct boolean
      * value if returnType is Boolean.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression07() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_B).
-                evaluate(document, BOOLEAN), false);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression07() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_B).
+            evaluate(document, BOOLEAN), false);
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) return correct number
      * value when return type is Double.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression08() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_A).
-                evaluate(document, NUMBER), 6d);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression08() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_A).
+            evaluate(document, NUMBER), 6d);
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) evaluate an attribute
      * value which returnType is Node.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression09() {
-        try {
-            Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
-                    evaluate(document, NODE);
-            assertEquals(attr.getValue(), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression09() throws XPathExpressionException {
+        Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
+                evaluate(document, NODE);
+        assertEquals(attr.getValue(), "6");
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) evaluate an attribute
      * value which returnType is NodeList.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression10() {
-        try {
-            NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
-                    evaluate(document, NODESET);
-            Attr attr = (Attr) nodeList.item(0);
-            assertEquals(attr.getValue(), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression10() throws XPathExpressionException {
+        NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
+                evaluate(document, NODESET);
+        Attr attr = (Attr) nodeList.item(0);
+        assertEquals(attr.getValue(), "6");
     }
 
     /**
      * Test for evaluate(java.lang.Object item) when returnType is left off of
      * the XPath.evaluate method, all expressions are evaluated to a String
      * value.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression11() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_A).evaluate(document), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression11() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_A).evaluate(document), "6");
     }
 
     /**
      * evaluate(java.lang.Object item) throws NPE if expression is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression12() {
-        try {
-            xpath.compile(null).evaluate(document);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression12() throws XPathExpressionException {
+        xpath.compile(null).evaluate(document);
     }
 
     /**
      * evaluate(java.lang.Object item) when a request is made to evaluate the
      * expression in the absence of a context item, simple expressions, such as
      * "1+1", can be evaluated.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression13() {
-        try {
-            assertEquals(xpath.compile("1+1").evaluate(document), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression13() throws XPathExpressionException {
+        assertEquals(xpath.compile("1+1").evaluate(document), "2");
     }
 
     /**
      * evaluate(java.lang.Object item) throws NPE if document is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression14() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression14() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(null);
     }
 
     /**
      * valuate(InputSource source) return a string value if return type is
      * String.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression15() {
+    @Test (groups = {"readLocalFiles"})
+    public void testCheckXPathExpression15() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
                     evaluate(new InputSource(is)), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source) throws NPE if input source is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression16() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression16() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(null);
     }
 
     /**
-     * evaluate(InputSource source) throws NPE if expression is null
+     * evaluate(InputSource source) throws NPE if expression is null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression17() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression17() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(null).evaluate(new InputSource(is));
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -332,14 +298,12 @@
      * evaluate(InputSource source) throws XPathExpressionException if
      * returnType is String junk characters.
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPathExpression18() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression18() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile("-*&").evaluate(new InputSource(is));
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -347,67 +311,63 @@
      * evaluate(InputSource source) throws XPathExpressionException if
      * expression is a blank string " ".
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPathExpression19() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression19() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(" ").evaluate(new InputSource(is));
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * Test for evaluate(InputSource source,QName returnType) returns a string
      * value if returnType is String.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression20() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression20() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
                 evaluate(new InputSource(is), STRING), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source,QName returnType) throws NPE if source is
      * null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression21() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(null, STRING);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression21() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(null, STRING);
     }
 
     /**
      * evaluate(InputSource source,QName returnType) throws NPE if expression is
      * null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression22() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression22() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(null).evaluate(new InputSource(is), STRING);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source,QName returnType) throws NPE if returnType is
      * null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression23() {
+    @Test(groups = {"readLocalFiles"}, 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);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -415,14 +375,12 @@
      * evaluate(InputSource source,QName returnType) throws
      * XPathExpressionException if expression is junk characters.
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPathExpression24() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression24() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile("-*&").evaluate(new InputSource(is), STRING);
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -430,14 +388,12 @@
      * evaluate(InputSource source,QName returnType) throws
      * XPathExpressionException if expression is blank " ".
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPathExpression25() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression25() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(" ").evaluate(new InputSource(is), STRING);
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -445,85 +401,85 @@
      * evaluate(InputSource source,QName returnType) throws
      * IllegalArgumentException if returnType is not one of the types defined
      * in XPathConstants.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testCheckXPathExpression26() {
+    @Test(groups = {"readLocalFiles"}, 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);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source,QName returnType) return a correct boolean
      * value if returnType is Boolean.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression27() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression27() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
                 evaluate(new InputSource(is), BOOLEAN), true);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source,QName returnType) return a correct boolean
      * value if returnType is Boolean.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression28() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression28() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_B).
                 evaluate(new InputSource(is), BOOLEAN), false);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source,QName returnType) return a correct number
      * value if returnType is Number.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression29() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression29() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
                 evaluate(new InputSource(is), NUMBER), 6d);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * Test for evaluate(InputSource source,QName returnType) returns a node if
      * returnType is Node.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression30() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression30() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
                 evaluate(new InputSource(is), NODE);
             assertEquals(attr.getValue(), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * Test for evaluate(InputSource source,QName returnType) return a node list
      * if returnType is NodeList.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression31() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression31() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
                 evaluate(new InputSource(is), NODESET);
             assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
-        } catch (XPathExpressionException | IOException  ex) {
-            failUnexpected(ex);
         }
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -26,14 +26,14 @@
 import static javax.xml.xpath.XPathConstants.DOM_OBJECT_MODEL;
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathFactoryConfigurationException;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPBaseTest;
 import static org.testng.AssertJUnit.assertNotNull;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for XPathFactory API.
  */
-public class XPathFactoryTest {
+public class XPathFactoryTest extends JAXPBaseTest {
     /**
      * Valid URL for creating a XPath factory.
      */
@@ -54,21 +54,21 @@
 
     /**
      * XPathFactory.newInstance(String uri) throws NPE if uri is null.
+     *
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    private void testCheckXPathFactory02() {
-        try {
-            XPathFactory.newInstance(null);
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFactory02() throws XPathFactoryConfigurationException {
+        XPathFactory.newInstance(null);
     }
 
     /**
      * XPathFactory.newInstance(String uri) throws XPFCE if uri is just a blank
      * string.
      *
-     * @throws XPathFactoryConfigurationException
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test(expectedExceptions = XPathFactoryConfigurationException.class)
     public void testCheckXPathFactory03() throws XPathFactoryConfigurationException {
@@ -78,21 +78,21 @@
     /**
      * Test for constructor - XPathFactory.newInstance(String uri) with valid
      * url - "http://java.sun.com/jaxp/xpath/dom".
+     *
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test
-    public void testCheckXPathFactory04() {
-        try {
-            assertNotNull(XPathFactory.newInstance(VALID_URL));
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFactory04() throws XPathFactoryConfigurationException {
+        assertNotNull(XPathFactory.newInstance(VALID_URL));
     }
 
     /**
      * Test for constructor - XPathFactory.newInstance(String uri) with invalid
      * url - "http://java.sun.com/jaxp/xpath/dom1".
      *
-     * @throws XPathFactoryConfigurationException
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test(expectedExceptions = XPathFactoryConfigurationException.class)
     public void testCheckXPathFactory05() throws XPathFactoryConfigurationException {
@@ -112,26 +112,24 @@
      * Test for constructor - XPathFactory.newInstance(String uri) with valid
      * url - "http://java.sun.com/jaxp/xpath/dom" and creating XPath with
      * newXPath().
+     *
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test
-    public void testCheckXPathFactory07() {
-        try {
-            assertNotNull(XPathFactory.newInstance(VALID_URL).newXPath());
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFactory07() throws XPathFactoryConfigurationException {
+        assertNotNull(XPathFactory.newInstance(VALID_URL).newXPath());
     }
 
     /**
      * Test for constructor - XPathFactory.newInstance(String uri) with valid
      * uri - DOM_OBJECT_MODEL.toString().
+     *
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test
-    public void testCheckXPathFactory08() {
-        try {
-            assertNotNull(XPathFactory.newInstance(DOM_OBJECT_MODEL));
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFactory08() throws XPathFactoryConfigurationException {
+        assertNotNull(XPathFactory.newInstance(DOM_OBJECT_MODEL));
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -26,7 +26,7 @@
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
@@ -34,7 +34,7 @@
 /**
  * Class containing the test cases for XPathFunctionResolver.
  */
-public class XPathFunctionResolverTest {
+public class XPathFunctionResolverTest extends JAXPBaseTest {
     /**
      * A XPath for evaluation environment and expressions.
      */
@@ -54,26 +54,22 @@
     /**
      * Test for resolveFunction(QName functionName,int arity). evaluate will
      * continue as long as functionName is meaningful.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathFunctionResolver01() {
-        try {
-            assertEquals(xpath.evaluate("round(1.7)", (Object)null), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFunctionResolver01() throws XPathExpressionException {
+        assertEquals(xpath.evaluate("round(1.7)", (Object)null), "2");
     }
 
     /**
      * Test for resolveFunction(QName functionName,int arity); evaluate throws
      * NPE if functionName  is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathFunctionResolver02() {
-        try {
-            assertEquals(xpath.evaluate(null, "5"), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFunctionResolver02() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(null, "5"), "2");
     }
 }
--- a/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 package javax.xml.xpath.ptests;
 
-import java.io.IOException;
+import java.io.FilePermission;
 import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -33,7 +33,6 @@
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.xpath.XPath;
 import static javax.xml.xpath.XPathConstants.BOOLEAN;
 import static javax.xml.xpath.XPathConstants.NODE;
@@ -43,7 +42,7 @@
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertNotNull;
 import static org.testng.AssertJUnit.assertNull;
@@ -53,12 +52,11 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * Class containing the test cases for XPath API.
  */
-public class XPathTest {
+public class XPathTest extends JAXPFileReadOnlyBaseTest {
     /**
      * Document object for testing XML file.
      */
@@ -91,13 +89,11 @@
 
     /**
      * Create Document object and XPath object for every time
-     * @throws ParserConfigurationException If the factory class cannot be
-     *                                      loaded, instantiated
-     * @throws SAXException If any parse errors occur.
-     * @throws IOException If operation on xml file failed.
+     * @throws Exception If any errors occur.
      */
     @BeforeTest
-    public void setup() throws ParserConfigurationException, SAXException, IOException {
+    public void setup() throws Exception {
+        setPermissions(new FilePermission(XML_DIR + "-", "read"));
         document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
         xpath = XPathFactory.newInstance().newXPath();
     }
@@ -105,62 +101,54 @@
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item, QName returnType) which return type is String.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath01() {
-        try {
-            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, STRING), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath01() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, STRING), "6");
     }
 
 
     /**
      * Test for XPath.compile(java.lang.String expression) and then
      * evaluate(java.lang.Object item, QName returnType).
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath02() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_A).evaluate(document, STRING), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath02() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_A).evaluate(document, STRING), "6");
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item) when the third argument is left off of the XPath.evaluate method,
      * all expressions are evaluated to a String value.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath03() {
-        try {
-            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath03() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document), "6");
     }
 
     /**
      * Test for XPath.compile(java.lang.String expression). If expression is
      * null, should throw NPE.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath04() {
-        try {
-            xpath.compile(null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath04() throws XPathExpressionException {
+        xpath.compile(null);
     }
 
     /**
      * Test for XPath.compile(java.lang.String expression). If expression cannot
      * be compiled junk characters, should throw XPathExpressionException.
      *
-     * @throws XPathExpressionException
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath05() throws XPathExpressionException {
@@ -171,7 +159,7 @@
      * Test for XPath.compile(java.lang.String expression). If expression is
      * blank, should throw XPathExpressionException
      *
-     * @throws XPathExpressionException
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath06() throws XPathExpressionException {
@@ -181,55 +169,46 @@
     /**
      * Test for XPath.compile(java.lang.String expression). The expression
      * cannot be evaluated as this does not exist.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath07() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_B).evaluate(document, STRING), "");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
-
+    public void testCheckXPath07() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_B).evaluate(document, STRING), "");
     }
 
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
-     * item, QName returnType). If String expression is null, should throw NPE
+     * item, QName returnType). If String expression is null, should throw NPE.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath08() {
-        try {
-            xpath.evaluate(null, document, STRING);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath08() throws XPathExpressionException {
+        xpath.evaluate(null, document, STRING);
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item, QName returnType). If item is null, should throw NPE.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath09() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, null, STRING);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath09() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, null, STRING);
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item, QName returnType). If returnType is null, should throw NPE.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath10() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, document, null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath10() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, document, null);
     }
 
     /**
@@ -237,23 +216,20 @@
      * item, QName returnType). If a request is made to evaluate the expression
      * in the absence of a context item, simple expressions, such as "1+1", can
      * be evaluated.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath11() {
-        try {
-            assertEquals(xpath.evaluate("1+1", document, STRING), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath11() throws XPathExpressionException {
+        assertEquals(xpath.evaluate("1+1", document, STRING), "2");
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) throws XPathExpressionException if expression is a empty
      * string "".
-     * .
      *
-     * @throws XPathExpressionException
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath12() throws XPathExpressionException {
@@ -264,161 +240,141 @@
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) throws IllegalArgumentException if returnType is not one of
      * the types defined in XPathConstants.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testCheckXPath13() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, document, TEST_QNAME);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath13() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, document, TEST_QNAME);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) returns correct boolean value if returnType is Boolean.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath14() {
-        try {
-            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, BOOLEAN), true);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath14() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, BOOLEAN), true);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) returns false as  expression is not successful in evaluating
      * to any result if returnType is Boolean.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath15() {
-        try {
-            assertEquals(xpath.evaluate(EXPRESSION_NAME_B, document, BOOLEAN), false);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath15() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(EXPRESSION_NAME_B, document, BOOLEAN), false);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) returns correct number value if return type is Number.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath16() {
-        try {
-            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, NUMBER), 6d);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath16() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, NUMBER), 6d);
     }
 
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) returns correct string value if return type is Node.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath17() {
-        try {
-            assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A, document, NODE)).getValue(), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath17() throws XPathExpressionException {
+        assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A, document, NODE)).getValue(), "6");
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item, QName returnType). If return type is NodeList,the evaluated value
      * equals to "6" as expected.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath18() {
-        try {
-            NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A, document, NODESET);
-            assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath18() throws XPathExpressionException {
+        NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A, document, NODESET);
+        assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item). If expression is null, should throw NPE.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath19() {
-        try {
-            xpath.evaluate(null, document);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath19() throws XPathExpressionException {
+        xpath.evaluate(null, document);
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item). If a request is made to evaluate the expression in the absence of
      * a context item, simple expressions, such as "1+1", can be evaluated.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath20() {
-        try {
-            assertEquals(xpath.evaluate("1+1", document), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath20() throws XPathExpressionException {
+        assertEquals(xpath.evaluate("1+1", document), "2");
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item) throws
      * NPE if InputSource is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath21() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath21() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, null);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source) return
      * correct value by looking for Node.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath22() {
+    @Test (groups = {"readLocalFiles"})
+    public void testCheckXPath22() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is)), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source) throws
      * NPE if InputSource is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath23() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath23() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, null);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source) throws
      * NPE if String expression is null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath24() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPath24() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(null, new InputSource(is));
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -427,14 +383,12 @@
      * If expression is junk characters, expression cannot be evaluated, should
      * throw XPathExpressionException.
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPath25() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath25() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate("-*&", new InputSource(is));
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -442,66 +396,62 @@
      * XPath.evaluate(java.lang.String expression, InputSource source) throws
      * XPathExpressionException if expression is blank " ".
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPath26() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath26() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(" ", new InputSource(is));
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source, QName
      * returnType) returns correct string value which return type is String.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath27() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath27() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), STRING), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source, QName
      * returnType) throws NPE if source is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath28() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, null, STRING);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath28() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, null, STRING);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source, QName
      * returnType) throws NPE if expression is null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath29() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPath29() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(null, new InputSource(is), STRING);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source,
-     * QName returnType) throws NPE if returnType is null .
+     * QName returnType) throws NPE if returnType is null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath30() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPath30() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), null);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -509,14 +459,12 @@
      * XPath.evaluate(java.lang.String expression, InputSource source, QName
      * returnType) throws XPathExpressionException if expression is junk characters.
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPath31() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath31() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate("-*&", new InputSource(is), STRING);
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -524,14 +472,12 @@
      * XPath.evaluate(java.lang.String expression, InputSource source, QName
      * returnType) throws XPathExpressionException if expression is blank " ".
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPath32() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath32() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(" ", new InputSource(is), STRING);
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -539,84 +485,84 @@
      * XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) throws IllegalArgumentException if returnType is not
      * one of the types defined in XPathConstants.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testCheckXPath33() {
+    @Test(groups = {"readLocalFiles"}, 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);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) return correct boolean value if return type is Boolean.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath34() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath34() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
                 BOOLEAN), true);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) return correct boolean value if return type is Boolean.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath35() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath35() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
                 BOOLEAN), false);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) return correct number value if return type is Number.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath36() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath36() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
                 NUMBER), 6d);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) return correct string value if return type is Node.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath37() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath37() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
                 new InputSource(is), NODE)).getValue(), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) which return type is NodeList.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath38() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath38() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
                 new InputSource(is), NODESET);
             assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -624,57 +570,57 @@
      * Test for XPath.evaluate(java.lang.String expression, InputSource iSource,
      * QName returnType). If return type is Boolean, should return false as
      * expression is not successful in evaluating to any result.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath52() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath52() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
                 BOOLEAN), false);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource iSource, QName
      * returnType) returns correct number value which return type is Number.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath53() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath53() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
                 NUMBER), 6d);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource iSource, QName
      * returnType) returns a node value if returnType is Node.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath54() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath54() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
                 new InputSource(is), NODE)).getValue(), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource iSource, QName
      * returnType) returns a node list if returnType is NodeList.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath55() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath55() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
                 new InputSource(is), NODESET);
             assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,6 +22,7 @@
  */
 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.Test;
@@ -30,7 +31,7 @@
 /**
  * Class containing the test cases for AttributesImpl API.
  */
-public class AttrImplTest {
+public class AttrImplTest extends JAXPBaseTest {
     private static final String CAR_URI = "http://www.cars.com/xml";
 
     private static final String CAR_LOCALNAME = "part";
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,20 +23,13 @@
 package org.xml.sax.ptests;
 
 import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 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 jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -45,39 +38,29 @@
  * ContentHandler has Attributes as one of its arguments. Attributes
  * pertaining to an element are taken into this argument and various methods
  * of Attributes interfaces are tested. This program uses Namespace processing
- * with namespaces in xml file. This program does not use Validation
+ * with namespaces in XML file. This program does not use Validation
  */
-public class AttributesNSTest {
+public class AttributesNSTest extends JAXPFileBaseTest {
     /**
      * Test for Attribute Interface's setter/getter.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "AttributesNS.out";
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "AttributesNS.out";
         String goldFile = GOLDEN_DIR + "AttributesNSGF.out";
         String xmlFile = XML_DIR + "namespace1.xml";
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            // http://www.saxproject.com/?selected=namespaces namespace-prefixes
-            //set to false to supress xmlns attributes
-            spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
-                                        false);
-            SAXParser saxParser = spf.newSAXParser();
-            MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
-            saxParser.parse(new File(xmlFile), myAttrCHandler);
-            myAttrCHandler.flushAndClose();
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException | ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        // http://www.saxproject.com/?selected=namespaces namespace-prefixes
+        //set to false to supress xmlns attributes
+        spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
+                                    false);
+        SAXParser saxParser = spf.newSAXParser();
+        MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
+        saxParser.parse(new File(xmlFile), myAttrCHandler);
+        myAttrCHandler.flushAndClose();
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,20 +23,13 @@
 package org.xml.sax.ptests;
 
 import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 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 jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -48,37 +41,28 @@
  * This program uses Namespace processing without any namepsaces in xml file.
  * This program uses Validation
  */
-public class AttributesTest {
+public class AttributesTest extends JAXPFileBaseTest {
     /**
      * Unit test for Attributes interface. Prints all attributes into output
      * file. Check it with golden file.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "Attributes.out";
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "Attributes.out";
         String goldFile = GOLDEN_DIR + "AttributesGF.out";
         String xmlFile = XML_DIR + "family.xml";
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
-                                        true);
-            spf.setValidating(true);
-            SAXParser saxParser = spf.newSAXParser();
-            MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
-            saxParser.parse(new File(xmlFile), myAttrCHandler);
-            myAttrCHandler.flushAndClose();
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException | ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
+
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
+                                    true);
+        spf.setValidating(true);
+        SAXParser saxParser = spf.newSAXParser();
+        MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
+        saxParser.parse(new File(xmlFile), myAttrCHandler);
+        myAttrCHandler.flushAndClose();
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -26,24 +26,18 @@
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -52,43 +46,34 @@
  * transverses XML and print all visited node  when XMLreader parses XML. Test
  * verifies output is same as the golden file.
  */
-public class ContentHandlerTest {
+public class ContentHandlerTest extends JAXPFileBaseTest {
     /**
      * Content event handler visit all nodes to print to output file.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "Content.out";
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "Content.out";
         String goldFile = GOLDEN_DIR + "ContentGF.out";
         String xmlFile = XML_DIR + "namespace1.xml";
 
-        try(FileInputStream instream = new FileInputStream(xmlFile)) {
+        try(FileInputStream instream = new FileInputStream(xmlFile);
+                MyContentHandler cHandler = new MyContentHandler(outputFile)) {
             SAXParserFactory spf = SAXParserFactory.newInstance();
             spf.setNamespaceAware(true);
             XMLReader xmlReader = spf.newSAXParser().getXMLReader();
-            ContentHandler cHandler = new MyContentHandler(outputFile);
             xmlReader.setContentHandler(cHandler);
-            InputSource is = new InputSource(instream);
-            xmlReader.parse(is);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch( IOException | SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
+            xmlReader.parse(new InputSource(instream));
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
 
 /**
  * A content write out handler.
  */
-class MyContentHandler extends XMLFilterImpl {
+class MyContentHandler extends XMLFilterImpl implements AutoCloseable {
     /**
      * Prefix to every exception.
      */
@@ -258,4 +243,14 @@
             throw new SAXException(WRITE_ERROR, ex);
         }
     }
+
+    /**
+     * Close the writer if it's initiated.
+     * @throws IOException if any IO error when close buffered writer.
+     */
+    @Override
+    public void close() throws IOException {
+        if (bWriter != null)
+            bWriter.close();
+    }
 }
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -26,15 +26,11 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 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 jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
@@ -42,7 +38,6 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -50,46 +45,32 @@
  * 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 {
+public class DefaultHandlerTest extends JAXPFileBaseTest {
     /**
      * Test default handler that transverses XML and  print all visited node.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testDefaultHandler() {
-        String outputFile = CLASS_DIR + "DefaultHandler.out";
+    public void testDefaultHandler() throws Exception {
+        String outputFile = USER_DIR + "DefaultHandler.out";
         String goldFile = GOLDEN_DIR + "DefaultHandlerGF.out";
         String xmlFile = XML_DIR + "namespace1.xml";
 
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxparser = spf.newSAXParser();
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        SAXParser saxparser = spf.newSAXParser();
 
-            MyDefaultHandler handler = new MyDefaultHandler(outputFile);
-            File file = new File(xmlFile);
-            String Absolutepath = file.getAbsolutePath();
-            String newAbsolutePath = Absolutepath;
-            if (File.separatorChar == '\\')
-                    newAbsolutePath = Absolutepath.replace('\\', '/');
-            String uri = "file:///" + newAbsolutePath;
-            saxparser.parse(uri, handler);
-        } catch (IOException | ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
-        // Need close the output file before we compare it with golden file.
-        try {
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
+        MyDefaultHandler handler = new MyDefaultHandler(outputFile);
+        File file = new File(xmlFile);
+        String Absolutepath = file.getAbsolutePath();
+        String newAbsolutePath = Absolutepath;
+        if (File.separatorChar == '\\')
+                newAbsolutePath = Absolutepath.replace('\\', '/');
+        saxparser.parse("file:///" + newAbsolutePath, handler);
+
+        assertTrue(compareWithGold(goldFile, outputFile));
+
     }
 }
 
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -26,23 +26,19 @@
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 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 jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
 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.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -50,14 +46,16 @@
  * ErrorHandler unit test. Set a ErrorHandle to XMLReader. Capture fatal error
  * events in ErrorHandler.
  */
-public class EHFatalTest {
+public class EHFatalTest extends JAXPFileBaseTest {
     /**
      * Error Handler to capture all error events to output file. Verifies the
      * output file is same as golden file.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testEHFatal() {
-        String outputFile = CLASS_DIR + "EHFatal.out";
+    public void testEHFatal() throws Exception {
+        String outputFile = USER_DIR + "EHFatal.out";
         String goldFile = GOLDEN_DIR + "EHFatalGF.out";
         String xmlFile = XML_DIR + "invalid.xml";
 
@@ -68,25 +66,12 @@
             xmlReader.setErrorHandler(eHandler);
             InputSource is = new InputSource(instream);
             xmlReader.parse(is);
-        } catch (IOException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        } catch (SAXException ex) {
-            System.out.println("This is expected:" + ex);
+            fail("Parse should throw SAXException");
+        } catch (SAXException expected) {
+            // This is expected.
         }
         // Need close the output file before we compare it with golden file.
-        try {
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
 
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/MyAttrCHandler.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +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 org.xml.sax.ptests;
-
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Simple attributes handler.
- */
-public class MyAttrCHandler extends DefaultHandler {
-    /**
-     * FileWriter to write string to output file.
-     */
-    private final BufferedWriter bWriter;
-
-    /**
-     * Initiate FileWriter
-     * @param fileName output file name.
-     * @throws IOException
-     */
-    public MyAttrCHandler(String fileName) throws IOException {
-        bWriter = new BufferedWriter(new FileWriter(fileName));
-    }
-
-    /**
-     * Write element content before start access every element.
-     * @throws org.xml.sax.SAXException
-     */
-    @Override
-    public void startElement(String uri, String localName,
-                String qName, Attributes attributes) throws SAXException {
-        try {
-            String string = "uri <" + uri + "> localName <" + localName +
-                        "> qName <" + qName + ">";
-
-            bWriter.write( string, 0, string.length());
-            bWriter.newLine();
-
-            int length = attributes.getLength();
-            string = "length: " + length;
-
-            bWriter.write( string, 0, string.length());
-            bWriter.newLine();
-
-            for (int ind=0; ind < length ; ind++) {
-                string = "For index = " + ind + "\n";
-                string += "getLocalName <" + attributes.getLocalName(ind)
-                                +">" + "\n";
-                string += "getQName <" + attributes.getQName(ind) +">" + "\n";
-                string += "getType <" + attributes.getType(ind) +">" + "\n";
-                string += "getURI <" + attributes.getURI(ind) +">" + "\n";
-                string += "getValue <" + attributes.getValue(ind) +">" + "\n";
-
-                bWriter.write( string, 0, string.length());
-                bWriter.newLine();
-
-                String gotLocalName = attributes.getLocalName(ind);
-                String gotQName = attributes.getQName(ind);
-                String gotURI = attributes.getURI(ind);
-
-                string ="Using localName, qname and uri pertaining to index = "
-                                + ind;
-                bWriter.write( string, 0, string.length());
-                bWriter.newLine();
-
-                string = "getIndex(qName) <" + attributes.getIndex(gotQName)
-                                +">" + "\n";
-                string += "getIndex(uri, localName) <" +
-                        attributes.getIndex(gotURI, gotLocalName) +">" + "\n";
-
-                string += "getType(qName) <" +
-                        attributes.getType(gotQName) +">" + "\n";
-                string += "getType(uri, localName) <" +
-                        attributes.getType(gotURI, gotLocalName) +">" + "\n";
-
-                string += "getValue(qName) <" +
-                        attributes.getValue(gotQName) +">" + "\n";
-                string += "getValue(uri, localName) <" +
-                        attributes.getValue(gotURI, gotLocalName) +">" + "\n";
-
-                bWriter.write( string, 0, string.length());
-                bWriter.newLine();
-            }
-            bWriter.newLine();
-        } catch(IOException ex){
-            throw new SAXException(ex);
-        }
-    }
-
-    /**
-     * Flush the stream and close the file.
-     * @throws IOException when writing or closing file failed.
-     */
-    public void flushAndClose() throws IOException {
-        bWriter.flush();
-        bWriter.close();
-    }
-}
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/MyNSContentHandler.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +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 org.xml.sax.ptests;
-
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.LocatorImpl;
-import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.FileWriter;
-import org.xml.sax.SAXException;
-
-class MyNSContentHandler extends DefaultHandler {
-    /**
-     * Prefix for written string.
-     */
-    private final static String WRITE_ERROR = "bWrite error";
-    /**
-     * FileWriter to write output file.
-     */
-    private final BufferedWriter bWriter;
-
-    /**
-     * Default locator.
-     */
-    Locator locator = new LocatorImpl();
-
-    /**
-     * Initiate FileWrite.
-     * @param outputFileName file name of output file.
-     * @throws SAXException when open output file failed.
-     */
-    public MyNSContentHandler(String outputFileName) throws SAXException {
-        try {
-            bWriter = new BufferedWriter(new FileWriter(outputFileName));
-        } catch (IOException ex) {
-            throw new SAXException(ex);
-        }
-    }
-
-    /**
-     * Write characters tag along with content of characters when meet
-     * characters event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void characters(char[] ch, int start, int length)
-            throws SAXException {
-        String s = new String(ch, start, length);
-        println("characters...length is:" + s.length() + "\n"
-                + "<" + s + ">");
-    }
-
-    /**
-     * Write endDocument tag then flush the content and close the file when meet
-     * endDocument event.
-     * @throws IOException error happen when writing file or closing file.
-     */
-    @Override
-    public void endDocument() throws SAXException {
-        try {
-            println("endDocument...");
-            bWriter.flush();
-            bWriter.close();
-        } catch (IOException ex) {
-            throw new SAXException(WRITE_ERROR, ex);
-        }
-    }
-
-    /**
-     * Write endElement tag with namespaceURI, localName, qName to the file when
-     * meet endElement event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void endElement(String namespaceURI, String localName, String qName)
-            throws SAXException {
-        println("endElement...\n" + "namespaceURI: <" + namespaceURI
-                + "> localName: <" + localName + "> qName: <" + qName + ">");
-    }
-
-    /**
-     * Write endPrefixMapping tag along with prefix to the file when meet
-     * endPrefixMapping event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void endPrefixMapping(String prefix) throws SAXException {
-        println("endPrefixMapping...\n" + "prefix: <" + prefix + ">");
-    }
-
-    /**
-     * Write ignorableWhitespace tag along with white spaces when meet
-     * ignorableWhitespace event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void ignorableWhitespace(char[] ch, int start, int length)
-            throws SAXException {
-        String s = new String(ch, start, length);
-        println("ignorableWhitespace...\n" + s
-                + " ignorable white space string length: " + s.length());
-    }
-
-    /**
-     * Write processingInstruction tag along with target name and target data
-     * when meet processingInstruction event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void processingInstruction(String target, String data)
-            throws SAXException {
-        println("processingInstruction...target:<" + target
-                + "> data: <" + data + ">");
-    }
-
-    /**
-     * Write setDocumentLocator tag when meet setDocumentLocator event.
-     */
-    @Override
-    public void setDocumentLocator(Locator locator) {
-        try {
-            this.locator = locator;
-            println("setDocumentLocator...");
-        } catch (SAXException ex) {
-            System.err.println(WRITE_ERROR + ex);
-        }
-    }
-
-    /**
-     * Write skippedEntity tag along with entity name when meet skippedEntity
-     * event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void skippedEntity(String name) throws SAXException {
-        println("skippedEntity...\n" + "name: <" + name + ">");
-    }
-
-    /**
-     * Write startDocument tag when meet startDocument event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void startDocument() throws SAXException {
-        println("startDocument...");
-    }
-
-    /**
-     * Write startElement tag along with namespaceURI, localName, qName, number
-     * of attributes and line number when meet startElement event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void startElement(String namespaceURI, String localName,
-            String qName, Attributes atts) throws SAXException {
-        println("startElement...\n" + "namespaceURI: <" + namespaceURI
-                + "> localName: <" + localName + "> qName: <" + qName
-                + "> Number of Attributes: <" + atts.getLength()
-                + "> Line# <" + locator.getLineNumber() + ">");
-    }
-
-    /**
-     * Write startPrefixMapping tag along with prefix and uri when meet
-     * startPrefixMapping event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void startPrefixMapping(String prefix, String uri)
-            throws SAXException {
-        println("startPrefixMapping...\n" + "prefix: <" + prefix
-                + "> uri: <" + uri + ">");
-    }
-    /**
-     * Write outString to output file.
-     * @param outString string to be written.
-     * @throws SAXException
-     */
-    private void println(String outString) throws SAXException {
-        try {
-            bWriter.write( outString, 0, outString.length());
-            bWriter.newLine();
-        } catch (IOException ex) {
-            throw new SAXException(WRITE_ERROR, ex);
-        }
-    }
-}
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java	Thu Jan 08 12:08:25 2015 -0800
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,6 +23,7 @@
 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 org.testng.annotations.Test;
@@ -31,7 +32,7 @@
 /**
  * Unit test cases for NamespaceSupport API
  */
-public class NSSupportTest {
+public class NSSupportTest extends JAXPBaseTest {
     /**
      * Empty prefix name.
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java	Thu Jan 15 19:10:56 2015 -0800
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2003, 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 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 org.testng.annotations.Test;
+import org.xml.sax.XMLReader;
+
+/**
+ * Class containing the test cases for Namespace Table defined at
+ * http://www.megginson.com/SAX/Java/namespaces.html
+ */
+public class NSTableTest extends JAXPBaseTest {
+    private static final String NAMESPACES =
+                        "http://xml.org/sax/features/namespaces";
+    private static final String NAMESPACE_PREFIXES =
+                        "http://xml.org/sax/features/namespace-prefixes";
+
+    /**
+     * Here namespace processing and namespace-prefixes are enabled.
+     * The testcase tests XMLReader for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void xrNSTable01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        SAXParser saxParser = spf.newSAXParser();
+
+        XMLReader xmlReader = saxParser.getXMLReader();
+        xmlReader.setFeature(NAMESPACE_PREFIXES, true);
+
+        assertTrue(xmlReader.getFeature(NAMESPACES));
+        assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing is enabled. This will make namespace-prefixes
+     * disabled. The testcase tests XMLReader for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void xrNSTable02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertTrue(xmlReader.getFeature(NAMESPACES));
+        assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing is disabled. This will make namespace-prefixes
+     * enabled. The testcase tests XMLReader for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void xrNSTable03() throws Exception {
+        XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+        assertFalse(xmlReader.getFeature(NAMESPACES));
+        assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing is disabled, and namespace-prefixes is
+     * disabled. This will make namespace processing on.The testcase tests
+     * XMLReader for this.  This behavior only apply to crimson, not
+     * XERCES.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void xrNSTable04() throws Exception {
+        XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+        xmlReader.setFeature(NAMESPACE_PREFIXES, false);
+        assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing and namespace-prefixes are enabled.
+     * The testcase tests SAXParserFactory for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void spNSTable01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setFeature(NAMESPACE_PREFIXES,true);
+        assertTrue(spf.getFeature(NAMESPACES));
+        assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing is enabled. This will make namespace-prefixes
+     * disabled. The testcase tests SAXParserFactory for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void spNSTable02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        assertTrue(spf.getFeature(NAMESPACES));
+        assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing is disabled. This will make namespace-prefixes
+     * enabled. The testcase tests SAXParserFactory for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void spNSTable03() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertFalse(spf.getFeature(NAMESPACES));
+        assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
+    }
+    /**
+     * Here namespace processing is disabled, and namespace-prefixes is
+     * disabled. This will make namespace processing on.The testcase tests
+     * SAXParserFactory for this.  This behavior only apply to crimson,
+     * not xerces.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void spNSTable04() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setFeature(NAMESPACE_PREFIXES, false);
+        assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
+    }
+}
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest01.java	Thu Jan 08 12:08:25 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +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 org.xml.sax.ptests;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.XMLReader;
-
-/**
- * Class containing the test cases for Namespace Table defined at
- * http://www.megginson.com/SAX/Java/namespaces.html
- */
-public class NSTableTest01 {
-    private static final String NAMESPACES =
-                        "http://xml.org/sax/features/namespaces";
-    private static final String NAMESPACE_PREFIXES =
-                        "http://xml.org/sax/features/namespace-prefixes";
-
-    /**
-     * Here namespace processing and namespace-prefixes are enabled.
-     * The testcase tests XMLReader for this.
-     */
-    @Test
-    public void xrNSTable01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxParser = spf.newSAXParser();
-
-            XMLReader xmlReader = saxParser.getXMLReader();
-            xmlReader.setFeature(NAMESPACE_PREFIXES, true);
-
-            assertTrue(xmlReader.getFeature(NAMESPACES));
-            assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Here namespace processing is enabled. This will make namespace-prefixes
-     * disabled. The testcase tests XMLReader for this.
-     */
-    @Test
-    public void xrNSTable02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxParser = spf.newSAXParser();
-
-            XMLReader xmlReader = saxParser.getXMLReader();
-            assertTrue(xmlReader.getFeature(NAMESPACES));
-            assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
-
-    }
-
-    /**
-     * Here namespace processing is disabled. This will make namespace-prefixes
-     * enabled. The testcase tests XMLReader for this.
-     */
-    @Test
-    public void xrNSTable03() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            SAXParser saxParser = spf.newSAXParser();
-            XMLReader xmlReader = saxParser.getXMLReader();
-            assertFalse(xmlReader.getFeature(NAMESPACES));
-            assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Here namespace processing is disabled, and namespace-prefixes is
-     * disabled. This will make namespace processing on.The testcase tests
-     * XMLReader for this.  This behavior only apply to crimson, not
-     * xerces
-     */
-    @Test
-    public void xrNSTable04() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            SAXParser saxParser = spf.newSAXParser();
-            XMLReader xmlReader = saxParser.getXMLReader();
-            xmlReader.setFeature(NAMESPACE_PREFIXES, false);
-
-            assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Here namespace processing and namespace-prefixes are enabled.
-     * The testcase tests SAXParserFactory for this.
-     */
-    @Test
-    public void spNSTable01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            spf.setFeature(NAMESPACE_PREFIXES,true);
-            assertTrue(spf.getFeature(NAMESPACES));
-            assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException
-                | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Here namespace processing is enabled. This will make namespace-prefixes
-     * disabled. The testcase tests SAXParserFactory for this.
-     */
-    @Test
-    public void spNSTable02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            assertTrue(spf.getFeature(NAMESPACES));
-            assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException
-                | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Here namespace processing is disabled. This will make namespace-prefixes
-     * enabled. The testcase tests SAXParserFactory for this.
-     */
-    @Test
-    public void spNSTable03() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertFalse(spf.getFeature(NAMESPACES));
-            assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException
-                | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
-    }
-    /**
-     * Here namespace processing is disabled, and namespace-prefixes is
-     * disabled. This will make namespace processing on.The testcase tests
-     * SAXParserFactory for this.  This behavior only apply to crimson,
-     * not xerces.