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 2026/05/22 17:04:00 UTC

[jira] [Created] (HDDS-15348) OmMultipartPartKeyCodec should not use UTF8.decode(..)

Tsz-wo Sze created HDDS-15348:
---------------------------------

             Summary: OmMultipartPartKeyCodec should not use UTF8.decode(..)
                 Key: HDDS-15348
                 URL: https://issues.apache.org/jira/browse/HDDS-15348
             Project: Apache Ozone
          Issue Type: Bug
          Components: OM
            Reporter: Tsz-wo Sze


We should use StringCodec since UTF_8.decode(..) below uses CodingErrorAction.REPLACE.  When there is an error, it will silently replace characters and cause unexpected behavior.  

When there is an error, the correct behavior is to throw an exception.

```java
// java.nio.charset.Charset.java
    public final CharBuffer decode(ByteBuffer bb) {
        try {
            return ThreadLocalCoders.decoderFor(this)
                .onMalformedInput(CodingErrorAction.REPLACE)
                .onUnmappableCharacter(CodingErrorAction.REPLACE)
                .decode(bb);
        } catch (CharacterCodingException x) {
            throw new Error(x);         // Can't happen
        }
    }
```



--
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