mx4j/src/core/javax/management/relation RelationService.java,1.31,1.32

Jeremy Boynes <[email protected]> Sun, 13 Feb 2005 20:33:51 +0000
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/core/javax/management/relation
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7917/src/core/javax/management/relation

Modified Files:
	RelationService.java 
Log Message:
Fix for [ 1121957 ] removeRelationType should throw RelationTypeNotFoundExceptio

Index: RelationService.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/javax/management/relation/RelationService.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** RelationService.java	13 Feb 2005 20:26:56 -0000	1.31
--- RelationService.java	13 Feb 2005 20:33:49 -0000	1.32
***************
*** 286,317 ****
        if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Removing RelationType with relationTypeName: " + relationTypeName);
  
!       List relationIdList;
!       List tempList = getRelationIds(relationTypeName);
  
-       if (tempList == null)
-       {
-          logger.debug("no relationType named " + relationTypeName + " has not been found: have you called addRelationType()");
-          tempList = new ArrayList();
- //throw new RelationTypeNotFoundException("RelationType with name: " + relationTypeName + " has not been found");
-       }
        // no need to clone as relationIdList is internal and get its values from a private method.
!       relationIdList = tempList;
        removeRelationTypeObject(relationTypeName);
        removeRelationTypeName(relationTypeName);
  
!       for (Iterator i = relationIdList.iterator(); i.hasNext();)
        {
!          String currentRelationId = (String)i.next();
!          try
!          {
! // removed the relationType now remove the relation
!             removeRelation(currentRelationId);
!          }
!          catch (RelationNotFoundException ex)
           {
!             throw new RuntimeOperationsException(null, ex.toString());
           }
        }
- 
     }
  
--- 286,314 ----
        if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Removing RelationType with relationTypeName: " + relationTypeName);
  
!       // will throw RelationTypeNotFoundException if not found
!       getRelationType(relationTypeName);
  
        // no need to clone as relationIdList is internal and get its values from a private method.
!       List relationIdList = getRelationIds(relationTypeName);
! 
        removeRelationTypeObject(relationTypeName);
        removeRelationTypeName(relationTypeName);
  
!       if (relationIdList != null)
        {
!          for (Iterator i = relationIdList.iterator(); i.hasNext();)
           {
!             String currentRelationId = (String)i.next();
!             try
!             {
!                // removed the relationType now remove the relation
!                removeRelation(currentRelationId);
!             }
!             catch (RelationNotFoundException ex)
!             {
!                throw new RuntimeOperationsException(null, ex.toString());
!             }
           }
        }
     }
  



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click