flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-6162) Fix bug in ByteArrayOutputStreamWithPos#setPosition
Date Wed, 29 Mar 2017 12:56:42 GMT

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

ASF GitHub Bot commented on FLINK-6162:
---------------------------------------

Github user greghogan commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3595#discussion_r108437565
  
    --- Diff: flink-core/src/main/java/org/apache/flink/core/memory/ByteArrayInputStreamWithPos.java
---
    @@ -118,7 +118,8 @@ public int getPosition() {
     		return position;
     	}
     
    -	public void setPos(int pos) {
    +	public void setPosition(int pos) {
    +		Preconditions.checkArgument(pos < count, "Position out of bounds.");
    --- End diff --
    
    Allow for equality as with `ByteArrayOutputStreamWithPos`? And check for non-negative.
Should we create a matching `getEndPosition()` as in `ByteArrayOutputStreamWithPos`?


> Fix bug in ByteArrayOutputStreamWithPos#setPosition
> ---------------------------------------------------
>
>                 Key: FLINK-6162
>                 URL: https://issues.apache.org/jira/browse/FLINK-6162
>             Project: Flink
>          Issue Type: Bug
>          Components: Core
>            Reporter: Wenlong Lyu
>            Assignee: Wenlong Lyu
>
> Currently the precondition check in setPosition will fail when the buffer is full: 
> {{Preconditions.checkArgument(position < getEndPosition(), "Position out of bounds.");}}
> We should allow the expected position to be the end position



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message