You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Tsz-wo Sze (Jira)" <ji...@apache.org> on 2023/05/29 19:10:00 UTC

[jira] [Commented] (HDDS-8724) FixedLengthStringCodec may silently replace unsupported characters

    [ https://issues.apache.org/jira/browse/HDDS-8724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17727183#comment-17727183 ] 

Tsz-wo Sze commented on HDDS-8724:
----------------------------------

{code}
  @Test
  public void testFixedLengthStringCodec() throws Exception {
    final Codec<String> codec = FixedLengthStringCodec.get();
    final String original = "Ozone 是 Hadoop 的分布式对象存储系统,具有易扩展和冗余存储的特点。";
    final byte[] encoded = codec.toPersistedFormat(original);
    final String decoded = codec.fromPersistedFormat(encoded);
    Assertions.assertEquals(original, decoded);
  }
{code}
The test above will fail.
{code}
org.opentest4j.AssertionFailedError: 
Expected :Ozone 是 Hadoop 的分布式对象存储系统,具有易扩展和冗余存储的特点。
Actual   :Ozone ? Hadoop ?????????????????????????
{code}


> FixedLengthStringCodec may silently replace unsupported characters
> ------------------------------------------------------------------
>
>                 Key: HDDS-8724
>                 URL: https://issues.apache.org/jira/browse/HDDS-8724
>             Project: Apache Ozone
>          Issue Type: Sub-task
>          Components: db
>            Reporter: Tsz-wo Sze
>            Assignee: Tsz-wo Sze
>            Priority: Major
>
> FixedLengthStringCodec simply uses String.getBytes(ASCII_CSN) to encode a string.  It may silently replace unsupported characters with '?'.  It should throw an exception instead.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org