db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3735) Incorrect position calculation in PositionedStoreStream with read(byte[],...)
Date Wed, 25 Jun 2008 12:41:45 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12608023#action_12608023

Knut Anders Hatlen commented on DERBY-3735:

The patch looks correct to me, and the change looks well tested. +1 to commit.

A tiny nit: Now that read(byte[],int,int) has the same structure as read() which is located
right below it, it would probably be better if they compared ret to the same number. Although
it doesn't matter whether the condition is (ret > 0) or (ret > -1) in this case, the
difference between the methods may be slightly confusing to those who read the code.

> Incorrect position calculation in PositionedStoreStream with read(byte[],...)
> -----------------------------------------------------------------------------
>                 Key: DERBY-3735
>                 URL: https://issues.apache.org/jira/browse/DERBY-3735
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Store
>    Affects Versions:,,
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-3735-1a.diff, derby-3735-1a.stat
> A bug in the methods 'read(byte[])' and 'read(byte[],int,int)' in PositionedStoreStream
can cause the position variable to be set to an incorrect value.
> The bug is only triggered if one of the two read methods is invoked after EOF of the
underlying stream has been reached.
> If the bug is triggered, the position will be decreased by one because the underlying
stream returns -1. Subsequent reads will further decrease the position. This can cause EOF-exceptions
(during repositioning) or incorrect data being returned in subsequent calls.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message