Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions release-notes/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,7 @@ Christian Beikov (@beikov)
* Reported #871: `XmlMapper` regression in 3.2.0: `xsi:nil` collection element on
unwrapped collection wrongly read as null collection
(3.3.0)

@Sahana2524
* Fixed #879: Use `Locale.ROOT` for case folding in `CaseInsensitiveNameSet`
(3.3.0)
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Version: 3.x (for earlier see VERSION-2.x)

#873: Fix handling of `@JsonApplyView`
(fix by @cowtowncoder, w/ Claude code)
#879: Use `Locale.ROOT` for case folding in `CaseInsensitiveNameSet`
(fix by @Sahana2524)

3.2.1 (10-Jul-2026)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private CaseInsensitiveNameSet(Set<String> namesToMatch) {
public static CaseInsensitiveNameSet construct(Set<String> names0) {
Set<String> namesToMatch = new HashSet<String>(names0);
for (String name : names0) {
namesToMatch.add(name.toLowerCase());
namesToMatch.add(name.toLowerCase(Locale.ROOT));
}
return new CaseInsensitiveNameSet(namesToMatch);
}
Expand All @@ -30,7 +30,7 @@ public boolean contains(Object key0) {
if (_namesToMatch.contains(key)) {
return true;
}
final String lc = key.toLowerCase();
final String lc = key.toLowerCase(Locale.ROOT);
return (lc != key) && _namesToMatch.contains(lc);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package tools.jackson.dataformat.xml.util;

import java.util.Collections;
import java.util.Locale;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.ResourceLock;
import org.junit.jupiter.api.parallel.Resources;

import tools.jackson.dataformat.xml.XmlTestUtil;

import static org.junit.jupiter.api.Assertions.*;

public class CaseInsensitiveNameSetTest extends XmlTestUtil
{
// Names with 'I'/'i' fold differently under the Turkish locale
// ("I".toLowerCase() -> dotless "ı"), so a set built with the default
// locale would stop matching them. Matching should not depend on the JVM's
// default locale.
@Test
// Mutates JVM-wide default Locale: needs exclusive access in case tests
// are ever run in parallel
@ResourceLock(Resources.LOCALE)
public void testMatchingIndependentOfDefaultLocale()
{
final Locale orig = Locale.getDefault();
try {
Locale.setDefault(Locale.forLanguageTag("tr"));

CaseInsensitiveNameSet set = CaseInsensitiveNameSet.construct(
Collections.singleton("ITEM"));
assertTrue(set.contains("item"),
"case-insensitive match of 'item' against 'ITEM' should hold under any locale");

set = CaseInsensitiveNameSet.construct(Collections.singleton("title"));
assertTrue(set.contains("TITLE"),
"case-insensitive match of 'TITLE' against 'title' should hold under any locale");
} finally {
Locale.setDefault(orig);
}
}
}