commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (DBCP-280) SequencedHashMap constructor calls overridable method; throws Error
Date Mon, 26 Jan 2009 22:45:59 GMT

     [ https://issues.apache.org/jira/browse/DBCP-280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sebb reopened DBCP-280:
-----------------------


I don't see how the scope or the origin of the code affects this.

If the class will never be extended, then make the class final.
If the method will never be overridden, then make the method final.
Otherwise, extract the code into a private method as originally suggested.

Since the fix to make the code safe is easy to do, it seems to me that it is worth doing to
avoid potential problems later.
I.e. defensive programming.

> SequencedHashMap constructor calls overridable method; throws Error
> -------------------------------------------------------------------
>
>                 Key: DBCP-280
>                 URL: https://issues.apache.org/jira/browse/DBCP-280
>             Project: Commons Dbcp
>          Issue Type: Bug
>            Reporter: Sebb
>
> The constructor SequencedHashMap(Map) calls the public non-final method putAll().
> This is likely to cause problems if the class is ever extended. Possible solution: extract
the code into a common private method.
> The next() method also throws an Error if the return type is unexpected.
> It should probably return IllegalStateException or similar.

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


Mime
View raw message