[ 
https://issues.apache.org/jira/browse/ACCUMULO-2299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13890381#comment-13890381
 ] 

Josh Elser commented on ACCUMULO-2299:
--------------------------------------

It would be better to use the {{expected}} parameter with the 
IllegalArgumentException on the JUnit Test annotation instead of the 

{code}
try {
  do();
  fail(); 
} catch  {
//pass 
}
{code}

The test case you wrote is subject to the serialization of the 
WholeRowIterator. I would think that it would be cleaner to serialize some 
key-values, truncate the byte array you pass to the decode method and test for 
a failure there. Then, you're not encoding serialization logic into your test 
case.

Also, do we want to throw an IllegalArgumentException, or should it just throw 
an IOException that's already in the method signature? I'm leaning towards the 
latter at first thought, but I'm not entirely sure.

> WholeRowIterator.decodeRow should check input stream return val
> ---------------------------------------------------------------
>
>                 Key: ACCUMULO-2299
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-2299
>             Project: Accumulo
>          Issue Type: Improvement
>    Affects Versions: 1.4.4, 1.5.0
>            Reporter: Josh Elser
>            Assignee: Vikram Srivastava
>            Priority: Minor
>              Labels: newbie
>             Fix For: 1.5.1
>
>         Attachments: ACCUMULO-2299.v1.patch.txt, ACCUMULO-2299.v2.patch.txt
>
>
> The decodeRow method ignores the return code on the DataInputStream.read 
> calls. If that return value is inspected, we can catch errors where the data 
> is malformed.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to