You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Yun Lee (JIRA)" <ji...@apache.org> on 2010/07/08 11:07:49 UTC

[jira] Created: (DERBY-4738) correct erorr prompt for nonpositive length in Blob.setBytesX()

correct erorr prompt for nonpositive length in Blob.setBytesX()
---------------------------------------------------------------

                 Key: DERBY-4738
                 URL: https://issues.apache.org/jira/browse/DERBY-4738
             Project: Derby
          Issue Type: Bug
            Reporter: Yun Lee
            Assignee: Yun Lee


In Blob.setBytesX(), when a nonpositive length value (len) is passed in, a SqlException with ClientMessageId of SQLState.BLOB_NONPOSITIVE_LENGTH is created, however, it uses length, a wrong length value, which is still zero here.

if ( len < 0 ) {
            throw new SqlException(agent_.logWriter_,
                new ClientMessageId(SQLState.BLOB_NONPOSITIVE_LENGTH),
                new Integer(length));
        }

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


[jira] Resolved: (DERBY-4738) correct error prompt for nonpositive length in Blob.setBytesX()

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen resolved DERBY-4738.
---------------------------------------

    Fix Version/s: 10.7.0.0
       Resolution: Fixed

> correct error prompt for nonpositive length in Blob.setBytesX()
> ---------------------------------------------------------------
>
>                 Key: DERBY-4738
>                 URL: https://issues.apache.org/jira/browse/DERBY-4738
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.0.0
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4738.patch, derby-4738.stat, init_length.diff
>
>
> In Blob.setBytesX(), when a nonpositive length value (len) is passed in, a SqlException with ClientMessageId of SQLState.BLOB_NONPOSITIVE_LENGTH is created, however, it uses length, a wrong length value, which is still zero here.
> if ( len < 0 ) {
>             throw new SqlException(agent_.logWriter_,
>                 new ClientMessageId(SQLState.BLOB_NONPOSITIVE_LENGTH),
>                 new Integer(length));
>         }

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


[jira] Updated: (DERBY-4738) correct error prompt for nonpositive length in Blob.setBytesX()

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4738:
--------------------------------------

        Summary: correct error prompt for nonpositive length in Blob.setBytesX()  (was: correct erorr prompt for nonpositive length in Blob.setBytesX())
    Component/s: JDBC

> correct error prompt for nonpositive length in Blob.setBytesX()
> ---------------------------------------------------------------
>
>                 Key: DERBY-4738
>                 URL: https://issues.apache.org/jira/browse/DERBY-4738
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>         Attachments: derby-4738.patch, derby-4738.stat
>
>
> In Blob.setBytesX(), when a nonpositive length value (len) is passed in, a SqlException with ClientMessageId of SQLState.BLOB_NONPOSITIVE_LENGTH is created, however, it uses length, a wrong length value, which is still zero here.
> if ( len < 0 ) {
>             throw new SqlException(agent_.logWriter_,
>                 new ClientMessageId(SQLState.BLOB_NONPOSITIVE_LENGTH),
>                 new Integer(length));
>         }

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


[jira] Updated: (DERBY-4738) correct erorr prompt for nonpositive length in Blob.setBytesX()

Posted by "Yun Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yun Lee updated DERBY-4738:
---------------------------

    Attachment: derby-4738.patch
                derby-4738.stat

In the patch, the nonpositive value is set by len.

> correct erorr prompt for nonpositive length in Blob.setBytesX()
> ---------------------------------------------------------------
>
>                 Key: DERBY-4738
>                 URL: https://issues.apache.org/jira/browse/DERBY-4738
>             Project: Derby
>          Issue Type: Bug
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>         Attachments: derby-4738.patch, derby-4738.stat
>
>
> In Blob.setBytesX(), when a nonpositive length value (len) is passed in, a SqlException with ClientMessageId of SQLState.BLOB_NONPOSITIVE_LENGTH is created, however, it uses length, a wrong length value, which is still zero here.
> if ( len < 0 ) {
>             throw new SqlException(agent_.logWriter_,
>                 new ClientMessageId(SQLState.BLOB_NONPOSITIVE_LENGTH),
>                 new Integer(length));
>         }

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


[jira] Closed: (DERBY-4738) correct error prompt for nonpositive length in Blob.setBytesX()

Posted by "Yun Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yun Lee closed DERBY-4738.
--------------------------


Thanks, Knut. Before I attached the patch, I just run BlobAccessTest and it passed. I will run regression tests for a extensive test next time. Thanks for your advice.

I agree with your patch on moving the declaration of the length variable. More work need to be done on this method, just pointed out in Derby-3898. 



> correct error prompt for nonpositive length in Blob.setBytesX()
> ---------------------------------------------------------------
>
>                 Key: DERBY-4738
>                 URL: https://issues.apache.org/jira/browse/DERBY-4738
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.0.0
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4738.patch, derby-4738.stat, init_length.diff
>
>
> In Blob.setBytesX(), when a nonpositive length value (len) is passed in, a SqlException with ClientMessageId of SQLState.BLOB_NONPOSITIVE_LENGTH is created, however, it uses length, a wrong length value, which is still zero here.
> if ( len < 0 ) {
>             throw new SqlException(agent_.logWriter_,
>                 new ClientMessageId(SQLState.BLOB_NONPOSITIVE_LENGTH),
>                 new Integer(length));
>         }

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


[jira] Commented: (DERBY-4738) correct error prompt for nonpositive length in Blob.setBytesX()

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886340#action_12886340 ] 

Knut Anders Hatlen commented on DERBY-4738:
-------------------------------------------

Hi Yun. Thanks for the patch. The fix looks correct to me. Did the regression tests run cleanly with patch?

Perhaps it would also be a good idea to stop setting length to 0 in the beginning of the method, so that the compiler could tell us if someone tries to use the variable before it's initialized.

> correct error prompt for nonpositive length in Blob.setBytesX()
> ---------------------------------------------------------------
>
>                 Key: DERBY-4738
>                 URL: https://issues.apache.org/jira/browse/DERBY-4738
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>         Attachments: derby-4738.patch, derby-4738.stat
>
>
> In Blob.setBytesX(), when a nonpositive length value (len) is passed in, a SqlException with ClientMessageId of SQLState.BLOB_NONPOSITIVE_LENGTH is created, however, it uses length, a wrong length value, which is still zero here.
> if ( len < 0 ) {
>             throw new SqlException(agent_.logWriter_,
>                 new ClientMessageId(SQLState.BLOB_NONPOSITIVE_LENGTH),
>                 new Integer(length));
>         }

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


[jira] Updated: (DERBY-4738) correct erorr prompt for nonpositive length in Blob.setBytesX()

Posted by "Yun Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yun Lee updated DERBY-4738:
---------------------------

    Issue & fix info: [Patch Available]

> correct erorr prompt for nonpositive length in Blob.setBytesX()
> ---------------------------------------------------------------
>
>                 Key: DERBY-4738
>                 URL: https://issues.apache.org/jira/browse/DERBY-4738
>             Project: Derby
>          Issue Type: Bug
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>         Attachments: derby-4738.patch, derby-4738.stat
>
>
> In Blob.setBytesX(), when a nonpositive length value (len) is passed in, a SqlException with ClientMessageId of SQLState.BLOB_NONPOSITIVE_LENGTH is created, however, it uses length, a wrong length value, which is still zero here.
> if ( len < 0 ) {
>             throw new SqlException(agent_.logWriter_,
>                 new ClientMessageId(SQLState.BLOB_NONPOSITIVE_LENGTH),
>                 new Integer(length));
>         }

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


[jira] Updated: (DERBY-4738) correct error prompt for nonpositive length in Blob.setBytesX()

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4738:
--------------------------------------

    Affects Version/s: 10.7.0.0
     Issue & fix info:   (was: [Patch Available])

All the regression tests ran cleanly in my environment.
Committed revision 961895.

> correct error prompt for nonpositive length in Blob.setBytesX()
> ---------------------------------------------------------------
>
>                 Key: DERBY-4738
>                 URL: https://issues.apache.org/jira/browse/DERBY-4738
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.0.0
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>         Attachments: derby-4738.patch, derby-4738.stat
>
>
> In Blob.setBytesX(), when a nonpositive length value (len) is passed in, a SqlException with ClientMessageId of SQLState.BLOB_NONPOSITIVE_LENGTH is created, however, it uses length, a wrong length value, which is still zero here.
> if ( len < 0 ) {
>             throw new SqlException(agent_.logWriter_,
>                 new ClientMessageId(SQLState.BLOB_NONPOSITIVE_LENGTH),
>                 new Integer(length));
>         }

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


[jira] Updated: (DERBY-4738) correct error prompt for nonpositive length in Blob.setBytesX()

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4738:
--------------------------------------

    Attachment: init_length.diff

The attached follow-up patch (init_length.diff) removes the initialization of the length variable to 0 from the top of the method, and moves the declaration of the variable down to the point where it's set to its real value. This will make the compiler complain if someone tries to use the length variable before it has been properly initialized.

Committed revision 961903.

> correct error prompt for nonpositive length in Blob.setBytesX()
> ---------------------------------------------------------------
>
>                 Key: DERBY-4738
>                 URL: https://issues.apache.org/jira/browse/DERBY-4738
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.0.0
>            Reporter: Yun Lee
>            Assignee: Yun Lee
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4738.patch, derby-4738.stat, init_length.diff
>
>
> In Blob.setBytesX(), when a nonpositive length value (len) is passed in, a SqlException with ClientMessageId of SQLState.BLOB_NONPOSITIVE_LENGTH is created, however, it uses length, a wrong length value, which is still zero here.
> if ( len < 0 ) {
>             throw new SqlException(agent_.logWriter_,
>                 new ClientMessageId(SQLState.BLOB_NONPOSITIVE_LENGTH),
>                 new Integer(length));
>         }

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