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

Nick Dimiduk commented on HBASE-13273:
--------------------------------------

Or Result should have been made an interface in our 1.0 API revamp, which 
EMPTY_RESULT being an implementation with mutation methods that throw.

Comment on copyFrom says

bq. Copy another Result into this one. Needed for the old Mapred framework

Indeed, the use case is instance-resuse, Writable-style. Copy constructor 
doesn't help this scenario. Probably best to do the copyFrom instance check 
[~stack] mentioned.

> Make Result.EMPTY_RESULT read-only; currently it can be modified
> ----------------------------------------------------------------
>
>                 Key: HBASE-13273
>                 URL: https://issues.apache.org/jira/browse/HBASE-13273
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.98.0, 1.0.0
>            Reporter: stack
>              Labels: beginner
>             Fix For: 2.0.0, 1.0.1, 1.1.0, 0.98.12
>
>
> Again from [~larsgeorge]
>     Result result2 = Result.EMPTY_RESULT;
>     System.out.println(result2);
>     result2.copyFrom(result1);
>     System.out.println(result2);
> "What do you think happens when result1 has cells? Yep, you just modified the 
> shared public EMPTY_RESULT to be not empty anymore."
> Fix. Result should be non-modifiable post-construction.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to