< prev index next >

test/javax/xml/jaxp/unittest/parsers/Bug6341770.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.
*** 28,53 **** import java.io.PrintWriter; import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; /* * @bug 6341770 * @summary Test external entity linked to non-ASCII base URL. */ public class Bug6341770 { // naming a file "aux" would fail on windows. @Test public void testNonAsciiURI() { try { ! File dir = File.createTempFile("sko\u0159ice", null); dir.delete(); dir.mkdir(); File main = new File(dir, "main.xml"); PrintWriter w = new PrintWriter(new FileWriter(main)); w.println("<!DOCTYPE r [<!ENTITY aux SYSTEM \"aux1.xml\">]>"); --- 28,55 ---- import java.io.PrintWriter; import javax.xml.parsers.SAXParserFactory; import org.testng.Assert; + import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; /* * @bug 6341770 * @summary Test external entity linked to non-ASCII base URL. */ + @Listeners({jaxp.library.FilePolicy.class}) public class Bug6341770 { // naming a file "aux" would fail on windows. @Test public void testNonAsciiURI() { try { ! File dir = new File("sko\u0159ice"); dir.delete(); dir.mkdir(); File main = new File(dir, "main.xml"); PrintWriter w = new PrintWriter(new FileWriter(main)); w.println("<!DOCTYPE r [<!ENTITY aux SYSTEM \"aux1.xml\">]>");
< prev index next >