6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 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.XMLEventReaderTest; 25 26 import org.testng.annotations.Test; 27 import org.testng.Assert; 28 import javax.xml.namespace.QName; 29 import javax.xml.stream.XMLEventReader; 30 import javax.xml.stream.XMLInputFactory; 31 import javax.xml.stream.XMLStreamConstants; 32 import javax.xml.stream.XMLStreamException; 33 import javax.xml.stream.events.XMLEvent; 34 35 /* 36 * @bug 6613059 37 * @summary Test XMLEventReader.nextTag() shall update internal event state, same as 6586466. 38 */ 39 public class Bug6613059Test { 40 41 @Test 42 public void test() { 43 String xmlFile = "bug6613059.xml"; 44 XMLEventReader xer = null; 45 XMLInputFactory xif = XMLInputFactory.newInstance(); 46 try { 47 xer = xif.createXMLEventReader(xif.createXMLStreamReader(getClass().getResource(xmlFile).getFile(), getClass().getResourceAsStream(xmlFile))); 48 } catch (XMLStreamException e) { 49 System.out.println("Error while reading XML: " + e.getClass().getName() + " " + e.getMessage()); 50 } 51 52 try { 53 while (xer.hasNext()) { 54 XMLEvent event = xer.nextTag(); 55 if (event.isEndElement() && event.asEndElement().getName().equals(new QName("menubar"))) { 56 break; 57 } 58 | 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 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.XMLEventReaderTest; 25 26 import org.testng.annotations.Listeners; 27 import org.testng.annotations.Test; 28 import org.testng.Assert; 29 import javax.xml.namespace.QName; 30 import javax.xml.stream.XMLEventReader; 31 import javax.xml.stream.XMLInputFactory; 32 import javax.xml.stream.XMLStreamConstants; 33 import javax.xml.stream.XMLStreamException; 34 import javax.xml.stream.events.XMLEvent; 35 36 /* 37 * @bug 6613059 38 * @summary Test XMLEventReader.nextTag() shall update internal event state, same as 6586466. 39 */ 40 @Listeners({jaxp.library.FilePolicy.class}) 41 public class Bug6613059Test { 42 43 @Test 44 public void test() { 45 String xmlFile = "bug6613059.xml"; 46 XMLEventReader xer = null; 47 XMLInputFactory xif = XMLInputFactory.newInstance(); 48 try { 49 xer = xif.createXMLEventReader(xif.createXMLStreamReader(getClass().getResource(xmlFile).getFile(), getClass().getResourceAsStream(xmlFile))); 50 } catch (XMLStreamException e) { 51 System.out.println("Error while reading XML: " + e.getClass().getName() + " " + e.getMessage()); 52 } 53 54 try { 55 while (xer.hasNext()) { 56 XMLEvent event = xer.nextTag(); 57 if (event.isEndElement() && event.asEndElement().getName().equals(new QName("menubar"))) { 58 break; 59 } 60 |