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-3215) Potential NullPointerException in CachedPage class
Date Mon, 19 Nov 2007 22:58:43 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543725

Knut Anders Hatlen commented on DERBY-3215:

Thanks Dag, the patch looks good to me. +1 to commit if the tests pass.

Perhaps out of the scope for this issue, but I think it would increase the readability of
the method if we moved the contents of the "else" part nearer the beginning of the method
and said

    FileContainer myContainer = ...;
    if (myContainer == null) {
        throw ...;

As it is now, with more than 50 lines between "if" and "else", it is not so easy to see what
"else" refers to.

> Potential NullPointerException in CachedPage class
> --------------------------------------------------
>                 Key: DERBY-3215
>                 URL: https://issues.apache.org/jira/browse/DERBY-3215
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions:
>         Environment: Windows XP
>            Reporter: Jason Valentine
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>             Fix For:
>         Attachments: DERBY-3215.diff
> There's a potential for a NullPointerException to be thrown in the in the org.apache.derby.impl.store.raw.data.CachedPage
class.  In the writePage() method, there's a test of the myContainer reference to ensure it's
not null (line 771), however in the else block, myContainer is dereferenced (line 836), where
a NullPointerException is guaranteed to be thrown.

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

View raw message