disc_tc.kind().value() == TCKind._tk_boolean ||
disc_tc.kind().value() == TCKind._tk_enum
)
)
{
throw new BAD_PARAM("Illegal union discriminator type",
20,
CompletionStatus.COMPLETED_NO );
}
// check that member names are legal (they do not need to be unique)
for( int i = 0; i < members.length; i++ )
{
checkTCMemberType( members[i].type );
if (checkName)
{
try
{
checkTCName( members[i].name );
}
catch( BAD_PARAM e )
{
logger.debug("Typecode name check failed", e);
throw new BAD_PARAM("Illegal union member name: " + members[i].name,
17,
CompletionStatus.COMPLETED_NO );
}
}
// check that member type matches discriminator type or is default
org.omg.CORBA.Any label = members[i].label;
if (! discriminator_type.equivalent( label.type() ) &&
! ( label.type().kind().value() == TCKind._tk_octet &&
label.extract_octet() == (byte)0
)
)
{
throw new BAD_PARAM("Label type does not match discriminator type",
19,
CompletionStatus.COMPLETED_NO );
}
// check that member labels are unique
for( int j = 0; j < i; j++ )
{
if( label.equal( members[j].label ))
{
throw new BAD_PARAM("Duplicate union case label",
18,
CompletionStatus.COMPLETED_NO );
}
}
}