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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to