EsotericSoftware / EsotericSoftware/kryo
Kryo5 deserialization lost Locale script field
- Dominant language
- HTML
- Stars
- 6.5k
- Forks
- 841
- Avg merge
- 39m
- Merged PRs (30d)
- 4
Description
**Describe the bug**
**java.util.Locale** **script** field in the is missing after deserialization with Kryo5, when we execute below UT method. we expect to get **sr_RS_#Cyrl** but actually we get the **sr_RS** which **script** is lost
```
expected [sr_RS_#Cyrl] but found [sr_RS]
java.lang.AssertionError: expected [sr_RS_#Cyrl] but found [sr_RS]
```
**To Reproduce**
```java
@Test
public void testLocaleScript() {
Kryo kryo = new Kryo();
kryo.setRegistrationRequired(false);
Locale locale = new Locale.Builder().setLanguage("sr").setScript("Cyrl").setRegion("RS").build();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (Output output = new Output(baos)) {
kryo.writeClassAndObject(output, locale);
}
Object deserializedLocale;
try (Input input = new Input(baos.toByteArray())){
deserializedLocale = kryo.readClassAndObject(input);
}
assertEquals(deserializedLocale.toString(), "sr_RS_#Cyrl");
}
```
**Environment:**
- OS: Windows/OSX/Ubuntu
- JDK Version: JDK17
- Kryo Version: 5.5.0
Contributor guide
Assessment
This issue has not been assessed yet.