[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-470) SeekableInMemoryByteChannel.truncate misimplements the contract

Under Flowerpot (JIRA) jira-events at lists.jboss.org
Tue Nov 5 16:39:02 EST 2013


    [ https://issues.jboss.org/browse/SHRINKWRAP-470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12851144#comment-12851144 ] 

Under Flowerpot commented on SHRINKWRAP-470:
--------------------------------------------

No PR.  I investigate shrinkwrap for its standalone features and implementation.  I am experimenting with my own nio2 FileSystem implementation of Zookeeper.


                
> SeekableInMemoryByteChannel.truncate misimplements the contract
> ---------------------------------------------------------------
>
>                 Key: SHRINKWRAP-470
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-470
>             Project: ShrinkWrap
>          Issue Type: Bug
>            Reporter: Under Flowerpot
>
> At the tail end of truncate, is this logic:
> {code}
> // If we've been given a size greater than we are
> if (newSize > currentSize) {
>     // Reset the position only
>     this.position = newSize;
> }
> {code}
> which is not what the API says: "If the given size is less than the current size then the entity is truncated, discarding any bytes beyond the new end. If the given size is greater than or equal to the current size then the entity is not modified."
> I think you wanted this instead, which should be inside the above array truncation:
> {code}
> // If we've been given a size less than we are
> if (newSize < currentSize) {
>     // Reset the size only
>     this.size = newSize;
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the shrinkwrap-issues mailing list