12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package stream.XMLStreamReaderTest; 25 26 import java.io.ByteArrayInputStream; 27 28 import javax.xml.stream.XMLInputFactory; 29 import javax.xml.stream.XMLStreamReader; 30 31 import org.testng.Assert; 32 import org.testng.annotations.Test; 33 34 /* 35 * @bug 6767322 36 * @summary Test XMLStreamReader.getVersion() returns null if a version isn't declared. 37 */ 38 public class Bug6767322Test { 39 private static final String INPUT_FILE = "Bug6767322.xml"; 40 41 @Test 42 public void testVersionSet() { 43 try { 44 XMLStreamReader r = XMLInputFactory.newInstance().createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(), 45 this.getClass().getResourceAsStream(INPUT_FILE)); 46 47 String version = r.getVersion(); 48 System.out.println("Bug6767322.xml: " + version); 49 50 } catch (Exception e) { 51 e.printStackTrace(); 52 Assert.fail("Exception occured: " + e.getMessage()); 53 } 54 } 55 56 @Test 57 public void testVersionNotSet() { | 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package stream.XMLStreamReaderTest; 25 26 import java.io.ByteArrayInputStream; 27 28 import javax.xml.stream.XMLInputFactory; 29 import javax.xml.stream.XMLStreamReader; 30 31 import org.testng.Assert; 32 import org.testng.annotations.Listeners; 33 import org.testng.annotations.Test; 34 35 /* 36 * @bug 6767322 37 * @summary Test XMLStreamReader.getVersion() returns null if a version isn't declared. 38 */ 39 @Listeners({jaxp.library.FilePolicy.class}) 40 public class Bug6767322Test { 41 private static final String INPUT_FILE = "Bug6767322.xml"; 42 43 @Test 44 public void testVersionSet() { 45 try { 46 XMLStreamReader r = XMLInputFactory.newInstance().createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(), 47 this.getClass().getResourceAsStream(INPUT_FILE)); 48 49 String version = r.getVersion(); 50 System.out.println("Bug6767322.xml: " + version); 51 52 } catch (Exception e) { 53 e.printStackTrace(); 54 Assert.fail("Exception occured: " + e.getMessage()); 55 } 56 } 57 58 @Test 59 public void testVersionNotSet() { |