[jboss-jira] [JBoss JIRA] Created: (JBMETA-325) AbstractMappedMetaData.remove doesn't remove the entry

jaikiran pai (JIRA) jira-events at lists.jboss.org
Fri Dec 24 13:58:17 EST 2010


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


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