From 94c662d1b85f8cd6530194f2c45790edd13a6718 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sun, 22 Nov 2026 17:23:08 +0100 Subject: [PATCH] Remove JDK 7 only test and no-op matrix exclude The disabled test targeted a JDK 7 string-concatenation bug. The shared workflow's default JDK matrix is 21, 25 and 8, so the jdk 11 exclusion never matched a cell. --- .github/workflows/maven.yml | 3 +- .../util/xml/PrettyPrintXMLWriterTest.java | 39 ------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 4849552..2b7d63f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -27,8 +27,7 @@ jobs: # Works with Java 17+ matrix-exclude: > [ - {"jdk": "8"}, - {"jdk": "11"} + {"jdk": "8"} ] deploy: diff --git a/src/test/java/org/codehaus/plexus/util/xml/PrettyPrintXMLWriterTest.java b/src/test/java/org/codehaus/plexus/util/xml/PrettyPrintXMLWriterTest.java index 04df4d7..ad5ca98 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/PrettyPrintXMLWriterTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/PrettyPrintXMLWriterTest.java @@ -18,21 +18,15 @@ import javax.swing.text.html.HTML.Tag; -import java.io.File; import java.io.StringWriter; -import java.io.Writer; -import java.nio.file.Files; import java.util.NoSuchElementException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; /** * Test of {@link org.codehaus.plexus.util.xml.PrettyPrintXMLWriter} @@ -161,39 +155,6 @@ void testendElementAlreadyClosed() { writer.endElement()); } - /** - * Issue #51: Issue 51 Purpose: test if concatenation string - * optimization bug is present. Target environment: Java 7 (u79 and u80 verified) running on Windows. Detection - * strategy: Tries to build a big XML file (~750MB size) and with many nested tags to force the JVM to trigger the - * concatenation string optimization bug that throws a NoSuchElementException when calling endElement() method. - * - * @throws java.io.IOException if an I/O error occurs - */ - @Disabled("This test is only relevant on JDK 1.7, which is not supported anymore") - @Test - void issue51DetectJava7ConcatenationBug() throws Exception { - File dir = new File("target/test-xml"); - if (!dir.exists()) { - assertTrue(dir.mkdir(), "cannot create directory test-xml"); - } - File xmlFile = new File(dir, "test-issue-51.xml"); - - int iterations = 20000; - - try (Writer osw = Files.newBufferedWriter(xmlFile.toPath())) { - writer = new PrettyPrintXMLWriter(osw); - for (int i = 0; i < iterations; ++i) { - writer.startElement(Tag.DIV.toString() + i); - writer.addAttribute("class", "someattribute"); - } - for (int i = 0; i < iterations; ++i) { - writer.endElement(); // closes Tag.DIV + i - } - } catch (NoSuchElementException e) { - fail("Should not throw a NoSuchElementException"); - } - } - private void writeXhtmlHead(XMLWriter writer) { writer.startElement(Tag.HEAD.toString()); writer.startElement(Tag.TITLE.toString());