[jboss-jira] [JBoss JIRA] Resolved: (JBMETA-325) AbstractMappedMetaData.remove doesn't remove the entry
jaikiran pai (JIRA)
jira-events at lists.jboss.org
Fri Dec 24 15:52:18 EST 2010
[ https://issues.jboss.org/browse/JBMETA-325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
jaikiran pai resolved JBMETA-325.
---------------------------------
Fix Version/s: jboss-metadata-common-2.0.0-alpha-24
Resolution: Done
> AbstractMappedMetaData.remove doesn't remove the entry
> ------------------------------------------------------
>
> Key: JBMETA-325
> URL: https://issues.jboss.org/browse/JBMETA-325
> Project: JBoss Metadata
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: common
> Affects Versions: jboss-metadata-common-2.0.0-alpha-23
> Reporter: jaikiran pai
> Assignee: jaikiran pai
> Fix For: jboss-metadata-common-2.0.0-alpha-24
>
>
> Consider this:
> DataSourcesMetaData dataSources = new DataSourcesMetaData();
> DataSourceMetaData ds1 = new DataSourceMetaData();
> ds1.setName("ds1");
> dataSources.add(ds1);
> and then doing:
> boolean removed = dataSources.remove(ds1);
> returns false and the entry isn't removed. This is due to a bug in AbstractMappedMetaData.remove which has this:
> public boolean remove(Object o)
> {
> if (o == null)
> throw new IllegalArgumentException("Null object");
> if (o instanceof MappableMetaData)
> return false;
>
> if (map == null)
> return false;
>
> MappableMetaData m = (MappableMetaData) o;
> String key = m.getKey();
> MappableMetaData v = map.get(key);
> if (m.equals(v))
> {
> T result = map.remove(key);
> if (result != null)
> {
> removeNotification(result);
> return true;
> }
> }
> return false;
> }
> the:
> if (o instanceof MappableMetaData)
> return false;
> should have been:
> if (!(o instanceof MappableMetaData))
> return false;
>
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list