Skip to content

Kryo5 deserialization lost Locale script field #1053

Description

@hanbing204

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

  @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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions