Skip to content

Conversation

@adoroszlai
Copy link
Contributor

What changes were proposed in this pull request?

OzoneFSInputStream#read(ByteBuffer) uses the target buffer's position for offsetting into the temporary array, which may result in an IndexOutOfBoundsException. Offset should always be 0, since the temporary array is sized exactly for the length to read, and it has no extra data at the start.

https://issues.apache.org/jira/browse/HDDS-2784

How was this patch tested?

Added unit test.

[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.143 s - in org.apache.hadoop.fs.ozone.contract.TestOzoneFSInputStreamUnit

https://github.com/adoroszlai/hadoop-ozone/runs/370513667

@adoroszlai adoroszlai self-assigned this Jan 2, 2020
@cxorm
Copy link
Member

cxorm commented Jan 2, 2020

Thanks @adoroszlai for the report and work.

Overll LGTM.
A little question, could we add new unit test in the existed file ?
(hadoop-ozone/ozonefs/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFSInputStream.java)

@adoroszlai
Copy link
Contributor Author

Thanks @cxorm for reviewing this.

A little question, could we add new unit test in the existed file ?
(hadoop-ozone/ozonefs/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFSInputStream.java)

That file is an integration test (uses mini cluster) and I proposed moving it to integration-test in #383. The new test cases are proper unit tests, and can be run without cluster.

@adoroszlai adoroszlai requested a review from mukul1987 January 3, 2020 11:15
@bshashikant bshashikant merged commit 7fb46e1 into apache:master Jan 6, 2020
@adoroszlai adoroszlai deleted the HDDS-2784 branch January 6, 2020 09:13
@adoroszlai
Copy link
Contributor Author

Thanks @cxorm and @bshashikant for review, and @bshashikant for committing it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants