1 /*
2 * Copyright (c) 2014, 2015, 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 */
26 import java.io.BufferedReader;
27 import java.io.ByteArrayInputStream;
28 import java.io.ByteArrayOutputStream;
29 import java.io.File;
30 import java.io.FileReader;
31 import java.io.IOException;
32 import java.io.InputStream;
33 import java.io.StringReader;
34 import java.io.StringWriter;
35
36 import javax.xml.transform.Result;
37 import javax.xml.transform.Source;
38 import javax.xml.transform.Transformer;
39 import javax.xml.transform.TransformerConfigurationException;
40 import javax.xml.transform.TransformerException;
41 import javax.xml.transform.TransformerFactory;
42 import javax.xml.transform.stream.StreamResult;
43 import javax.xml.transform.stream.StreamSource;
44
45 import org.testng.Assert;
46 import org.testng.annotations.Test;
47
48 /*
49 * @bug 6935697
50 * @summary Test Transformer can compile large xsl file.
51 */
52 public class BugDB12665704Test {
53
54 @Test
55 public final void testTransform() {
56
57 try {
58 String str = new String();
59 ByteArrayOutputStream byte_stream = new ByteArrayOutputStream();
60 File inputFile = new File(getClass().getResource("BugDB12665704.xml").getPath());
61 FileReader in = new FileReader(inputFile);
62 int c;
63
64 while ((c = in.read()) != -1) {
65 str = str + new Character((char) c).toString();
66 }
67
68 in.close();
69
70 System.out.println(str);
71 byte buf[] = str.getBytes();
|
1 /*
2 * Copyright (c) 2014, 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 */
26 import java.io.BufferedReader;
27 import java.io.ByteArrayInputStream;
28 import java.io.ByteArrayOutputStream;
29 import java.io.File;
30 import java.io.FileReader;
31 import java.io.IOException;
32 import java.io.InputStream;
33 import java.io.StringReader;
34 import java.io.StringWriter;
35
36 import javax.xml.transform.Result;
37 import javax.xml.transform.Source;
38 import javax.xml.transform.Transformer;
39 import javax.xml.transform.TransformerConfigurationException;
40 import javax.xml.transform.TransformerException;
41 import javax.xml.transform.TransformerFactory;
42 import javax.xml.transform.stream.StreamResult;
43 import javax.xml.transform.stream.StreamSource;
44
45 import org.testng.Assert;
46 import org.testng.annotations.Listeners;
47 import org.testng.annotations.Test;
48
49 /*
50 * @bug 6935697
51 * @summary Test Transformer can compile large xsl file.
52 */
53 @Listeners({jaxp.library.FilePolicy.class})
54 public class BugDB12665704Test {
55
56 @Test
57 public final void testTransform() {
58
59 try {
60 String str = new String();
61 ByteArrayOutputStream byte_stream = new ByteArrayOutputStream();
62 File inputFile = new File(getClass().getResource("BugDB12665704.xml").getPath());
63 FileReader in = new FileReader(inputFile);
64 int c;
65
66 while ((c = in.read()) != -1) {
67 str = str + new Character((char) c).toString();
68 }
69
70 in.close();
71
72 System.out.println(str);
73 byte buf[] = str.getBytes();
|