|
18 | 18 |
|
19 | 19 | import javax.swing.text.html.HTML.Tag; |
20 | 20 |
|
21 | | -import java.io.File; |
22 | | -import java.io.IOException; |
23 | | -import java.io.OutputStreamWriter; |
24 | 21 | import java.io.StringWriter; |
25 | | -import java.nio.charset.StandardCharsets; |
26 | | -import java.nio.file.Files; |
27 | 22 | import java.util.NoSuchElementException; |
28 | 23 |
|
29 | 24 | import org.codehaus.plexus.util.StringUtils; |
|
32 | 27 | import org.junit.jupiter.api.Test; |
33 | 28 |
|
34 | 29 | import static org.junit.jupiter.api.Assertions.assertEquals; |
35 | | -import static org.junit.jupiter.api.Assertions.assertTrue; |
36 | 30 | import static org.junit.jupiter.api.Assertions.fail; |
37 | 31 |
|
38 | 32 | /** |
@@ -142,37 +136,6 @@ void testendElementAlreadyClosed() { |
142 | 136 | } |
143 | 137 | } |
144 | 138 |
|
145 | | - /** |
146 | | - * Issue #51: https://github.com/codehaus-plexus/plexus-utils/issues/51 Purpose: test if concatenation string |
147 | | - * optimization bug is present. Target environment: Java 7 (u79 and u80 verified) running on Windows. Detection |
148 | | - * strategy: Tries to build a big XML file (~750MB size) and with many nested tags to force the JVM to trigger the |
149 | | - * concatenation string optimization bug that throws a NoSuchElementException when calling endElement() method. |
150 | | - * |
151 | | - * @throws java.io.IOException if an I/O error occurs |
152 | | - */ |
153 | | - @Test |
154 | | - void issue51DetectJava7ConcatenationBug() throws IOException { |
155 | | - File dir = new File("target/test-xml"); |
156 | | - if (!dir.exists()) { |
157 | | - assertTrue(dir.mkdir(), "cannot create directory test-xml"); |
158 | | - } |
159 | | - File xmlFile = new File(dir, "test-issue-51.xml"); |
160 | | - try (OutputStreamWriter osw = |
161 | | - new OutputStreamWriter(Files.newOutputStream(xmlFile.toPath()), StandardCharsets.UTF_8); ) { |
162 | | - writer = new PrettyPrintXMLWriter(osw); |
163 | | - int iterations = 20000; |
164 | | - for (int i = 0; i < iterations; ++i) { |
165 | | - writer.startElement(Tag.DIV.toString() + i); |
166 | | - writer.addAttribute("class", "someattribute"); |
167 | | - } |
168 | | - for (int i = 0; i < iterations; ++i) { |
169 | | - writer.endElement(); // closes Tag.DIV + i |
170 | | - } |
171 | | - } catch (NoSuchElementException e) { |
172 | | - fail("Should not throw a NoSuchElementException"); |
173 | | - } |
174 | | - } |
175 | | - |
176 | 139 | private void writeXhtmlHead(XMLWriter writer) { |
177 | 140 | writer.startElement(Tag.HEAD.toString()); |
178 | 141 | writer.startElement(Tag.TITLE.toString()); |
|
0 commit comments