< prev index next >

test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2014, 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. --- 1,7 ---- /* ! * Copyright (c) 2014, 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.
*** 36,47 **** import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; ! import org.testng.annotations.Test; import org.testng.Assert; import org.xml.sax.Attributes; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; --- 36,50 ---- import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; ! import jaxp.library.JAXPTestUtilities; ! import org.testng.Assert; + import org.testng.annotations.Listeners; + import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader;
*** 49,67 **** /* * @bug 7057778 * @summary Test the file can be deleted after SAXParser.parse(File, DefaultHandler). */ public class Bug7057778Test { static final String xml = "Bug7057778.xml"; static final String xml1 = "Bug7057778_1.xml"; @Test public void testParse() { File src = new File(getClass().getResource(xml).getFile()); ! File dst = new File(src.getParent() + File.separator + xml1); try { copyFile(src, dst); SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser parser = spf.newSAXParser(); XMLReader xmlReader = parser.getXMLReader(); --- 52,71 ---- /* * @bug 7057778 * @summary Test the file can be deleted after SAXParser.parse(File, DefaultHandler). */ + @Listeners({jaxp.library.FilePolicy.class}) public class Bug7057778Test { static final String xml = "Bug7057778.xml"; static final String xml1 = "Bug7057778_1.xml"; @Test public void testParse() { File src = new File(getClass().getResource(xml).getFile()); ! File dst = new File(xml1); try { copyFile(src, dst); SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser parser = spf.newSAXParser(); XMLReader xmlReader = parser.getXMLReader();
*** 96,106 **** } in.close(); out.close(); } ! public class MyHandler1 extends DefaultHandler2 implements ErrorHandler { private Writer out; StringBuffer textBuffer; private String indentString = " "; // Amount to indent private int indentLevel = 0; --- 100,111 ---- } in.close(); out.close(); } ! @Listeners({jaxp.library.BasePolicy.class}) ! public class MyHandler1 extends DefaultHandler2 implements ErrorHandler { private Writer out; StringBuffer textBuffer; private String indentString = " "; // Amount to indent private int indentLevel = 0;
< prev index next >