Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hey team.
Thanks to RandomizedTesting framework, I found today this weird issue which only seems to happen when using az as the Locale.
Here is a test which reproduces this behavior:
package fr.pilato.elasticsearch.crawler.fs.settings;
import org.github.gestalt.config.Gestalt;
import org.github.gestalt.config.builder.GestaltBuilder;
import org.github.gestalt.config.source.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.Locale;
import static org.assertj.core.api.Assertions.assertThat;
public class ConfigTest {
private static final Locale savedLocale = Locale.getDefault();
@After
public void resetLocale() {
Locale.setDefault(savedLocale);
}
@Test
public void testLocaleAz() throws Exception {
Locale.setDefault(new Locale.Builder().setLanguageTag("az").build());
Gestalt gestalt = new GestaltBuilder()
.addSource(MapConfigSourceBuilder.builder()
.addCustomConfig("elasticsearch.index", "foo")
.build())
.build();
gestalt.loadConfigs();
assertThat(gestalt.getConfigOptional("elasticsearch", Elasticsearch.class)).isPresent();
}
@Test
public void testLocaleFr() throws Exception {
Locale.setDefault(new Locale.Builder().setLanguageTag("fr").build());
Gestalt gestalt = new GestaltBuilder()
.addSource(MapConfigSourceBuilder.builder()
.addCustomConfig("elasticsearch.index", "foo")
.build())
.build();
gestalt.loadConfigs();
assertThat(gestalt.getConfigOptional("elasticsearch", Elasticsearch.class)).isPresent();
}
}The testLocaleFr passes but the testLocaleAz is failing.
I'm using the following libs:
- Junit4
- AssertJ
HTH
Reacted by Colin Redmond
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
credmond-git commentedon Apr 9, 2025
Thanks for reporting this issue and including detailed unit tests.
I added the test to Gestalt in a branch at https://github.com/gestalt-config/gestalt/blob/bug/242-locale/gestalt-bug/src/test/java/gestalt/ConfigTest.java
That branch built and passed all tests.
https://github.com/gestalt-config/gestalt/actions/runs/14362328750/job/40266736538
Is there any additional steps needed to reproduce this?
dadoonet commentedon Apr 10, 2025
Very interesting. I should have tried this in a blank empty project instead of within mine. I think there's a dependency issue here or something like this which is also loaded in my classpath causing this behavior.
So I'm going to try to add in a blank project all the deps I have and remove one by one to see when the problem is disappearing.
This might take me some days before I can do it though.
I will share the full test repo when ready.
dadoonet commentedon Apr 11, 2025
Interesting. When the
Elasticsearchclass is created within theConfigTestclass (inner class), then no issue.When it's a class from the outside, I can see the problem. But give me some time to reproduce that in an isolated project.
Thanks
dadoonet commentedon Apr 11, 2025
It was not about that. I managed to reproduce the issue with:
HTH
credmond-git commentedon Apr 11, 2025
I found the root cause of the issue.
Gestalt uses the following pattern to tokenize a path.
pattern:
^((?<name>[\w .,+=\-;:"'`~!@#$%^&*()\<>]+)(?<array>\[(?<index>\d*)])?)$When presented with the word: 'flushinterval'
the following doesn't find a match in the PathLexer:
Matcher matcher = pathPattern.matcher(word);It seems to work in every other Locale, but Az?
I need to look into why this is happening, and how to fix it.
credmond-git commentedon Apr 11, 2025
I also made a fix so we can support different languages Unicode characters for object field names. #244
credmond-git commentedon Apr 11, 2025
Please try release v0.35.7 to see if it fixes the issue.
dadoonet commentedon Apr 11, 2025
That's great! It fixes the issue. thanks!