1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 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 /* @test 25 * @bug 8169112 26 * @summary Test compilation of large xsl file with outlining. 27 * @run testng/othervm TransformerTest 28 */ 29 30 import java.io.ByteArrayInputStream; 31 import java.io.ByteArrayOutputStream; 32 import java.io.FileNotFoundException; 33 34 import javax.xml.transform.Transformer; 35 import javax.xml.transform.TransformerException; 36 import javax.xml.transform.TransformerFactory; 37 import javax.xml.transform.stream.StreamResult; 38 import javax.xml.transform.stream.StreamSource; 39 40 import org.testng.annotations.Test; 41 42 public class TransformerTest { 43 44 /** 45 * @bug 8169112 46 * @summary Test compilation of large xsl file with outlining. 47 * 48 * This test merely compiles a large xsl file and tests if its bytecode 49 * passes verification by invoking the transform() method for 50 * dummy content. The test succeeds if no Exception is thrown 51 */ 52 @Test 53 public final void testBug8169112() throws FileNotFoundException, 54 TransformerException 55 { 56 TransformerFactory tf = TransformerFactory.newInstance(); 57 String xslFile = getClass().getResource("Bug8169112.xsl").toString(); 58 Transformer t = tf.newTransformer(new StreamSource(xslFile)); 59 String xmlIn = "<?xml version=\"1.0\"?><DOCROOT/>"; 60 ByteArrayInputStream bis = new ByteArrayInputStream(xmlIn.getBytes()); 61 ByteArrayOutputStream bos = new ByteArrayOutputStream(); 62 t.transform(new StreamSource(bis), new StreamResult(bos)); 63 } 64 }