You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2009/11/23 01:25:39 UTC

[jira] Created: (DBCP-307) PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class

PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class
------------------------------------------------------------------------------------------------------------------------------------

                 Key: DBCP-307
                 URL: https://issues.apache.org/jira/browse/DBCP-307
             Project: Commons Dbcp
          Issue Type: Bug
            Reporter: Sebb


PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class.

Instead, they rely on catching NPE and ClassCastException.

Although this should work, it's very bad practice, and will be slower than the corrected code if the NPE or CCE is ever thrown.
[Patch to follow]

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


[jira] Closed: (DBCP-307) PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class

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

Phil Steitz closed DBCP-307.
----------------------------

    Resolution: Won't Fix

Per comments above,  exceptions should not be generated by DBCP internal use

> PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBCP-307
>                 URL: https://issues.apache.org/jira/browse/DBCP-307
>             Project: Commons Dbcp
>          Issue Type: Bug
>            Reporter: Sebb
>         Attachments: dbcp_307.txt
>
>
> PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class.
> Instead, they rely on catching NPE and ClassCastException.
> Although this should work, it's very bad practice, and will be slower than the corrected code if the NPE or CCE is ever thrown.
> [Patch to follow]

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


[jira] Commented: (DBCP-307) PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBCP-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781308#action_12781308 ] 

Phil Steitz commented on DBCP-307:
----------------------------------

Understand the point on bad practice, but this looks like it was done for performance.  The exception cases should not happen in practice.  Might be better to comment the code and leave as is.

> PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBCP-307
>                 URL: https://issues.apache.org/jira/browse/DBCP-307
>             Project: Commons Dbcp
>          Issue Type: Bug
>            Reporter: Sebb
>         Attachments: dbcp_307.txt
>
>
> PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class.
> Instead, they rely on catching NPE and ClassCastException.
> Although this should work, it's very bad practice, and will be slower than the corrected code if the NPE or CCE is ever thrown.
> [Patch to follow]

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


[jira] Updated: (DBCP-307) PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class

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

Sebb updated DBCP-307:
----------------------

    Attachment: dbcp_307.txt

> PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBCP-307
>                 URL: https://issues.apache.org/jira/browse/DBCP-307
>             Project: Commons Dbcp
>          Issue Type: Bug
>            Reporter: Sebb
>         Attachments: dbcp_307.txt
>
>
> PoolingConnection.PStmtKey.equals() and cpdsadapter.PooledConnectionImpl.PStmtKey.equals() don't check for null or the correct class.
> Instead, they rely on catching NPE and ClassCastException.
> Although this should work, it's very bad practice, and will be slower than the corrected code if the NPE or CCE is ever thrown.
> [Patch to follow]

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