harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vera Petrashkova (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4450) [classlib][x-management] RelationService.createRelation method throws InvalidRoleValueException when RoleList parameter is null
Date Fri, 13 Jul 2007 03:44:04 GMT
[classlib][x-management] RelationService.createRelation method throws InvalidRoleValueException
when RoleList parameter is null

                 Key: HARMONY-4450
                 URL: https://issues.apache.org/jira/browse/HARMONY-4450
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Vera Petrashkova
            Priority: Minor

According to J2SE API specifications of javax.management.relation.RelationService class:

public void createRelation(String theRelId, String theRelTypeName, RoleList theRoleList)
                    throws RelationServiceNotRegisteredException,
    theRoleList - role list to initialize roles of the relation (can be null). 

    IllegalArgumentException - if null parameter, except the role list which can be null if
no role initialization 
    InvalidRoleValueException - if: 
    - the same role name is used for two different roles 
    - the number of referenced MBeans in given value is less than expected minimum degree

    - the number of referenced MBeans in provided value exceeds expected maximum degree 
    - one referenced MBean in the value is not an Object of the MBean class expected for that
    - an MBean provided for that role does not exist

But creatRelation methods throws InvalidRoleValueException when RoleList parameter is null.
This behavior is compatible with RI behavior but it contradicts with specification.

To reproduce this issue run the following test:
import javax.management.*;
import javax.management.relation.*;
public class test {
    private static final String classPath = Unit.class.getName();
    public static void main(String[] args) {        
        try {
            MBeanServer mBeanServer = MBeanServerFactory.createMBeanServer();
            RelationService relationService = new RelationService(true);
            ObjectName relationServiceName = new ObjectName(
            mBeanServer.registerMBean(relationService, relationServiceName);

            UnitMBean unit1 = new Unit();
            ObjectName unitName = new ObjectName("mBeanServer:type=Unit,name=Unit1");
            mBeanServer.registerMBean(unit1, unitName);

            RoleInfo[] roleInfo = new RoleInfo[1];
            roleInfo[0] = new RoleInfo("Role", classPath, true, true, 1, 1,
                "The Role can contain any number of MBeans");

            relationService.createRelationType("internalRelationType", roleInfo);

            RoleList rl = null;
                    "internalRelationType", rl);
            System.err.println("Test passes");

        } catch (Exception e) {
            System.err.println("Test fails");
public interface UnitMBean {

public class Unit implements UnitMBean {
See output:
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r551077, (Jun 27 2007), Windows/ia32/msvc 1310, release build
Created MBeanServer with ID: UID[2078520c:113bda4fa48:-8000]:nswvpetrash:1
Minimum number of references defined in the RoleInfo has fallen below minimum
Test fails
javax.management.relation.InvalidRoleValueException: RoleName: Role has references less th
an the expected minimum.
        at javax.management.relation.RelationService.throwRoleProblemException(RelationService.java:2102)
        at javax.management.relation.RelationSupport.setRole(RelationSupport.java:219)
        at javax.management.relation.RelationService.initializeMissingCreateRoles(RelationService.java:503)
        at javax.management.relation.RelationService.createRelation(RelationService.java:378)
        at test.main(test.java:24)

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

Test fails
javax.management.relation.InvalidRoleValueException: Role has a number of MBean references
 less than the expected minimum degree.
        at javax.management.relation.RelationService.throwRoleProblemException(RelationService.java:3703)
        at javax.management.relation.RelationSupport.setRoleInt(RelationSupport.java:1248)
        at javax.management.relation.RelationService.initialiseMissingRoles(RelationService.java:3574)
        at javax.management.relation.RelationService.addRelationInt(RelationService.java:3265)
        at javax.management.relation.RelationService.createRelation(RelationService.java:594)
        at test.main(test.java:24)

This issue causes the failure of the following functional test

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

View raw message