[ 
https://issues.apache.org/jira/browse/HADOOP-6226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12750329#action_12750329
 ] 

Hong Tang commented on HADOOP-6226:
-----------------------------------

@Jothi, thanks for taking time porting the class to io package and writing unit 
tests for it. Some comments for consideration:

- The comment of the test case refers to the class LimitedByteArrayOutputStream.
{code}
+/** Unit tests for LimitedByteArrayOutputStream */
{code}

- Should put some random contents in the input byte array. Something like the 
following (capitalize variable INPUT because it is now static final):
{code}
private static final byte[] INPUT = new byte[SIZE];
static {
    new Random().nextBytes(INPUT);
}
{code}

- Suggest to write only one byte to test whether an exception is thrown due to 
limit exceeded.

- Suggest to test that after reset() and writing INPUT, writing one more byte 
would cause an exception.

- Suggest to do reset(SIZE-1) instead of reset(SIZE/2).

- Suggest to add an assertion (getLimit() == SIZE) after reset() and 
(getLimit() == SIZE-1) after reset(SIZE-1).

> Create a LimitedByteArrayOutputStream that does not expand its buffer on write
> ------------------------------------------------------------------------------
>
>                 Key: HADOOP-6226
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6226
>             Project: Hadoop Common
>          Issue Type: New Feature
>    Affects Versions: 0.20.0
>            Reporter: Jothi Padmanabhan
>            Assignee: Jothi Padmanabhan
>             Fix For: 0.21.0
>
>         Attachments: hadoop-6226-v1.patch, hadoop-6226-v2.patch, 
> hadoop-6226.patch
>
>
> For MAPREDUCE-318, we would benefit from a ByteArrayOutputStream that would 
> support a fixed size buffer that will not expand dynamically on writes. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to