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

Michael Dürig commented on OAK-956:
-----------------------------------

I think the test has wrong expectations:

{code}
byte[] target = new byte[readSize];
int read = bis.read(target);
 // ensure everything could be read
assertEquals(readSize, read);
{code}

The contract of {{read}} says "reads *up to byte.length* bytes". An 
implementation may still return fewer than that and this is exactly what 
{{BIS}} does. Relying on {{read}} filling the provided buffer is certainly 
wrong. 

{{SegmentStream.available()}} returning 0 is perfectly fine as this means that 
the next read call will block, which is indeed the case.



> SegmentStream doesn't implement the method available()
> ------------------------------------------------------
>
>                 Key: OAK-956
>                 URL: https://issues.apache.org/jira/browse/OAK-956
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: Antonio Sanso
>
>  org.apache.jackrabbit.oak.plugins.segment.SegmentStream doesn't implement 
> the method available()
> {code}
> Value.getStream().available()
> {code}
> will always return 0



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to