< prev index next >
test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -20,28 +20,31 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.xml.sax.ptests;
-import java.io.FileInputStream;
-import java.io.FilePermission;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.HandlerBase;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderAdapter;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
/**
* Class containing the test cases for XMLReaderAdapter API
*/
-public class XMLReaderAdapterTest extends JAXPBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLReaderAdapterTest {
/**
* http://xml.org/sax/features/namespace-prefixes property name.
*/
private final static String NM_PREFIXES_PROPERTY
= "http://xml.org/sax/features/namespace-prefixes";
@@ -90,18 +93,16 @@
*
* @throws Exception If any errors occur.
*/
@Test
public void parse01() throws Exception {
- setPermissions(new FilePermission(XML_DIR + "/-", "read"));
try (FileInputStream fis = new FileInputStream(XML_DIR + "namespace1.xml")) {
XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
if (!xmlReader.getFeature(NM_PREFIXES_PROPERTY)) {
xmlReader.setFeature(NM_PREFIXES_PROPERTY, true);
}
XMLReaderAdapter xmlRA = new XMLReaderAdapter(xmlReader);
xmlRA.setDocumentHandler(new HandlerBase());
xmlRA.parse(new InputSource(fis));
}
- setPermissions();
}
}
< prev index next >