< prev index next >

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

Print this page

        

@@ -22,13 +22,15 @@
  */
 package common;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
+import java.io.FilePermission;
 import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
 import java.net.URISyntaxException;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLInputFactory;

@@ -37,12 +39,16 @@
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
+
+import jaxp.library.JAXPTestUtilities;
+
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;

@@ -50,10 +56,11 @@
 /*
  * @bug 8144967
  * @summary Tests related to the javax.xml.transform.Source
  * and org.xml.sax.InputSource
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class Sources {
 
     /**
      * @bug 8144967
      * Tests whether a Source object is empty

@@ -106,24 +113,26 @@
 
     /*
      * DataProvider: sources that are not empty
      */
     @DataProvider(name = "nonEmptySources")
-    Object[][] getSourcesEx() throws URISyntaxException {
+    Object[][] getSourcesEx() {
         StAXSource ss = null;
         try {
             ss = new StAXSource(getXMLEventReader());
-        } catch (XMLStreamException ex) {}
+        } catch (XMLStreamException ex) {
+        }
 
-        return new Object[][]{
-            //This will set a non-null systemId on the resulting StreamSource
-            {new StreamSource(new File(""))},
-            //Can't tell because XMLStreamReader is a pull parser, cursor advancement
-            //would have been required in order to examine the reader.
-            {new StAXSource(getXMLStreamReader())},
-            {ss}
-        };
+        return new Object[][] {
+            // This will set a non-null systemId on the resulting
+            // StreamSource
+            { new StreamSource(new File("")) },// )},
+            // Can't tell because XMLStreamReader is a pull parser, cursor
+            // advancement
+            // would have been required in order to examine the reader.
+            { new StAXSource(getXMLStreamReader()) },
+            { ss } };
     }
 
     /*
      * DataProvider: sources that are empty
      */
< prev index next >