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

Jeremy Boynes <[email protected]> Sun, 13 Feb 2005 20:26:59 +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-serv4533/src/core/javax/management/relation

Modified Files:
	RelationService.java 
Log Message:
Fix for [ 1121945 ] addRelationType should fail with invalid args

Index: RelationService.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/javax/management/relation/RelationService.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** RelationService.java	13 Feb 2005 20:04:42 -0000	1.30
--- RelationService.java	13 Feb 2005 20:26:56 -0000	1.31
***************
*** 190,193 ****
--- 190,197 ----
        if (relationType == null) throw new IllegalArgumentException("Relation Type should not be null.");
  
+       // check type name
+       String relationTypeName = relationType.getRelationTypeName();
+       if (relationTypeName == null) throw new IllegalArgumentException("RelationTypeName must not be null");
+ 
        Logger logger = getLogger();
        if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Adding a RelationType");
***************
*** 197,201 ****
        {
           logger.warn("Cannot add RelationType: " + relationType.getClass().getName() + " RoleInfo information was not provided with the RelationType.");
!          throw new IllegalArgumentException("No RoleInfo provided with Relation Type");
        }
        // build the roleInfo[] to validate the RoleInfo
--- 201,205 ----
        {
           logger.warn("Cannot add RelationType: " + relationType.getClass().getName() + " RoleInfo information was not provided with the RelationType.");
!          throw new InvalidRelationTypeException("No RoleInfo provided with Relation Type");
        }
        // build the roleInfo[] to validate the RoleInfo
***************
*** 210,214 ****
        // need to validateRoleInfos before adding
        RelationTypeSupport.checkRoleInfos(roleInfos);
!       String relationTypeName = relationType.getRelationTypeName();
        // validated add the RelationType
        addRelationTypeToMap(relationTypeName, relationType);
--- 214,218 ----
        // need to validateRoleInfos before adding
        RelationTypeSupport.checkRoleInfos(roleInfos);
! 
        // validated add the RelationType
        addRelationTypeToMap(relationTypeName, relationType);



-------------------------------------------------------
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