Skip to content

Commit 13b639c

Browse files
Dolverintriceo
andauthored
fix: make XXE protection test locale-resilient (#2102)
- The `GenericJaxbIOTest.readOverridingNamespaceIsProtectedFromXXE` test asserts on the English error message `"DOCTYPE is disallowed"`, which fails on non-English JVM locales (e.g. `de_DE` produces `"DOCTYPE ist nicht zulässig"`) - Changed the assertion to match `"disallow-doctype-decl"` instead — the XML parser feature name, which is locale-independent and always present in the `SAXParseException` message --------- Co-authored-by: Dolverin <dolverin@users.noreply.github.com> Co-authored-by: Lukáš Petrovický <lukas@petrovicky.net>
1 parent 38c1f1c commit 13b639c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

core/src/test/java/ai/timefold/solver/core/impl/io/jaxb/GenericJaxbIOTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void readOverridingNamespaceIsProtectedFromXXE() {
4747
assertThatExceptionOfType(TimefoldXmlSerializationException.class)
4848
.isThrownBy(() -> xmlIO.readOverridingNamespace(new StringReader(maliciousXml)))
4949
.withRootCauseExactlyInstanceOf(SAXParseException.class)
50-
.withStackTraceContaining("DOCTYPE is disallowed");
50+
.withStackTraceContaining("disallow-doctype-decl");
5151
}
5252

5353
@XmlRootElement

0 commit comments

Comments
 (0)