[
https://issues.apache.org/jira/browse/HDDS-16721?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chu Cheng Li updated HDDS-16721:
--------------------------------
Target Version/s: 2.3.0
> StreamBlockInputStream.read() returns a negative value for bytes 0x80 to 0xFF
> -----------------------------------------------------------------------------
>
> Key: HDDS-16721
> URL: https://issues.apache.org/jira/browse/HDDS-16721
> Project: Apache Ozone
> Issue Type: Sub-task
> Components: Ozone Client
> Reporter: Chu Cheng Li
> Assignee: Chu Cheng Li
> Priority: Major
>
> *Problem*
> {{StreamBlockInputStream.read()}} returns the value from
> {{readBuffer.getByteBuffer().get()}}. It does not change this signed byte to
> an unsigned value. Thus:
> * A byte from 0x80 to 0xFE gives a negative value.
> * The byte 0xFF gives -1. For a caller, -1 means the end of the stream.
> {{InputStream.read()}} must return a value from 0 to 255, or -1 at the end of
> the stream.
> *Effect*
> The problem occurs in the streaming read
> ({{ozone.client.stream.readblock.enable}}) when a caller reads one byte at a
> time. {{KeyInputStream}} reads into a {{ByteBuffer}}. Thus, most reads do not
> have this problem.
> *Fix*
> * Change {{read()}} to return {{Byte.toUnsignedInt(...)}}.
> * Add a test that reads the byte 0xFF.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]