Java Code Examples for org.omg.CORBA.TypeCodePackage.BadKind

The following are top voted examples for showing how to use org.omg.CORBA.TypeCodePackage.BadKind. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: AnyImpl.java   View source code 6 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_string(String s)
{
    //debug.log ("insert_string");
    // Make sure type code information for bounded strings is not erased
    if (typeCode.kind() == TCKind.tk_string) {
        int length = 0;
        try {
            length = typeCode.length();
        } catch (BadKind bad) {
            throw wrapper.badkindCannotOccur() ;
        }

        // Check if bounded strings length is not exceeded
        if (length != 0 && s != null && s.length() > length) {
            throw wrapper.badStringBounds( new Integer(s.length()),
                new Integer(length) ) ;
        }
    } else {
        typeCode = orb.get_primitive_tc(TCKind._tk_string);
    }
    object = s;
    isInitialized = true;
}
 
Example 2
Project: OpenJSharp   File: AnyImpl.java   View source code 6 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_wstring(String s)
{
    //debug.log ("insert_wstring");
    // Make sure type code information for bounded strings is not erased
    if (typeCode.kind() == TCKind.tk_wstring) {
        int length = 0;
        try {
            length = typeCode.length();
        } catch (BadKind bad) {
            throw wrapper.badkindCannotOccur() ;
        }

        // Check if bounded strings length is not exceeded
        if (length != 0 && s != null && s.length() > length) {
            throw wrapper.badStringBounds( new Integer(s.length()),
                new Integer(length) ) ;
        }
    } else {
        typeCode = orb.get_primitive_tc(TCKind._tk_wstring);
    }
    object = s;
    isInitialized = true;
}
 
Example 3
Project: OpenJSharp   File: AnyImpl.java   View source code 6 votes vote down vote up
public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type)
{
    try {
        if (TypeCodeImpl.digits(value) > type.fixed_digits() ||
            TypeCodeImpl.scale(value) > type.fixed_scale())
        {
            throw wrapper.fixedNotMatch() ;
        }
    } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
        // type isn't even of kind fixed
        throw wrapper.fixedBadTypecode( bk ) ;
    }
    typeCode = TypeCodeImpl.convertToNative(orb, type);
    object = value;
    isInitialized = true;
}
 
Example 4
Project: OpenJSharp   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public String id()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        //return indirectType().id(); // same as _id
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        // exception and objref typecodes must have a repository id.
        // structs, unions, enums, and aliases may or may not.
        return _id;
    default:
        // all other typecodes throw the BadKind exception.
        throw new BadKind();
    }
}
 
Example 5
Project: OpenJSharp   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public String name()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().name();
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        return _name;
    default:
        throw new BadKind();
    }
}
 
Example 6
Project: OpenJSharp   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public int member_count()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_count();
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_value:
        return _memberCount;
    default:
        throw new BadKind();
    }
}
 
Example 7
Project: OpenJSharp   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public String member_name(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_name(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_value:
        try {
            return _memberNames[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 8
Project: OpenJSharp   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public TypeCode member_type(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_type(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_value:
        try {
            return _memberTypes[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 9
Project: OpenJSharp   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public Any member_label(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_label(index);
    case TCKind._tk_union:
        try {
            // _REVISIT_ Why create a new Any for this?
            return new AnyImpl(_orb, _unionLabels[index]);
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 10
Project: OpenJSharp   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public TypeCode content_type()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().content_type();
    case TCKind._tk_sequence:
        return lazy_content_type();
    case TCKind._tk_array:
    case TCKind._tk_alias:
    case TCKind._tk_value_box:
        return _contentType;
    default:
        throw new BadKind();
    }
}
 
Example 11
Project: OpenJSharp   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
int currentUnionMemberIndex(Any discriminatorValue) throws BadKind {
    if (_kind != TCKind._tk_union)
        throw new BadKind();

    try {
        for (int i=0; i<member_count(); i++) {
            if (member_label(i).equal(discriminatorValue)) {
                return i;
            }
        }
        if (_defaultIndex != -1) {
            return _defaultIndex;
        }
    } catch (BadKind bad) {
    } catch (org.omg.CORBA.TypeCodePackage.Bounds bounds) {
    }
    return -1;
}
 
Example 12
Project: OpenJSharp   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public void insert_string(String value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_string)
        throw new TypeMismatch();
    if (value == null)
        throw new InvalidValue();
    // Throw InvalidValue if this is a bounded string and the length is exceeded
    try {
        if (any.type().length() > 0 && any.type().length() < value.length())
            throw new InvalidValue();
    } catch (BadKind bad) { // impossible
    }
    any.insert_string(value);
}
 
Example 13
Project: OpenJSharp   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public void insert_wstring(String value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_wstring)
        throw new TypeMismatch();
    if (value == null)
        throw new InvalidValue();
    // Throw InvalidValue if this is a bounded string and the length is exceeded
    try {
        if (any.type().length() > 0 && any.type().length() < value.length())
            throw new InvalidValue();
    } catch (BadKind bad) { // impossible
    }
    any.insert_wstring(value);
}
 
Example 14
Project: OpenJSharp   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 15
Project: openjdk-jdk10   File: AnyImpl.java   View source code 6 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_string(String s)
{
    //debug.log ("insert_string");
    // Make sure type code information for bounded strings is not erased
    if (typeCode.kind() == TCKind.tk_string) {
        int length = 0;
        try {
            length = typeCode.length();
        } catch (BadKind bad) {
            throw wrapper.badkindCannotOccur() ;
        }

        // Check if bounded strings length is not exceeded
        if (length != 0 && s != null && s.length() > length) {
            throw wrapper.badStringBounds( new Integer(s.length()),
                new Integer(length) ) ;
        }
    } else {
        typeCode = orb.get_primitive_tc(TCKind._tk_string);
    }
    object = s;
    isInitialized = true;
}
 
Example 16
Project: openjdk-jdk10   File: AnyImpl.java   View source code 6 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_wstring(String s)
{
    //debug.log ("insert_wstring");
    // Make sure type code information for bounded strings is not erased
    if (typeCode.kind() == TCKind.tk_wstring) {
        int length = 0;
        try {
            length = typeCode.length();
        } catch (BadKind bad) {
            throw wrapper.badkindCannotOccur() ;
        }

        // Check if bounded strings length is not exceeded
        if (length != 0 && s != null && s.length() > length) {
            throw wrapper.badStringBounds( new Integer(s.length()),
                new Integer(length) ) ;
        }
    } else {
        typeCode = orb.get_primitive_tc(TCKind._tk_wstring);
    }
    object = s;
    isInitialized = true;
}
 
Example 17
Project: openjdk-jdk10   File: AnyImpl.java   View source code 6 votes vote down vote up
public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type)
{
    try {
        if (TypeCodeImpl.digits(value) > type.fixed_digits() ||
            TypeCodeImpl.scale(value) > type.fixed_scale())
        {
            throw wrapper.fixedNotMatch() ;
        }
    } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
        // type isn't even of kind fixed
        throw wrapper.fixedBadTypecode( bk ) ;
    }
    typeCode = TypeCodeImpl.convertToNative(orb, type);
    object = value;
    isInitialized = true;
}
 
Example 18
Project: openjdk-jdk10   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public String id()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        //return indirectType().id(); // same as _id
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        // exception and objref typecodes must have a repository id.
        // structs, unions, enums, and aliases may or may not.
        return _id;
    default:
        // all other typecodes throw the BadKind exception.
        throw new BadKind();
    }
}
 
Example 19
Project: openjdk-jdk10   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public String name()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().name();
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        return _name;
    default:
        throw new BadKind();
    }
}
 
Example 20
Project: openjdk-jdk10   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public int member_count()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_count();
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_value:
        return _memberCount;
    default:
        throw new BadKind();
    }
}
 
Example 21
Project: openjdk-jdk10   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public String member_name(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_name(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_value:
        try {
            return _memberNames[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 22
Project: openjdk-jdk10   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public TypeCode member_type(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_type(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_value:
        try {
            return _memberTypes[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 23
Project: openjdk-jdk10   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public Any member_label(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_label(index);
    case TCKind._tk_union:
        try {
            // _REVISIT_ Why create a new Any for this?
            return new AnyImpl(_orb, _unionLabels[index]);
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 24
Project: openjdk-jdk10   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public TypeCode content_type()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().content_type();
    case TCKind._tk_sequence:
        return lazy_content_type();
    case TCKind._tk_array:
    case TCKind._tk_alias:
    case TCKind._tk_value_box:
        return _contentType;
    default:
        throw new BadKind();
    }
}
 
Example 25
Project: openjdk-jdk10   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
int currentUnionMemberIndex(Any discriminatorValue) throws BadKind {
    if (_kind != TCKind._tk_union)
        throw new BadKind();

    try {
        for (int i=0; i<member_count(); i++) {
            if (member_label(i).equal(discriminatorValue)) {
                return i;
            }
        }
        if (_defaultIndex != -1) {
            return _defaultIndex;
        }
    } catch (BadKind bad) {
    } catch (org.omg.CORBA.TypeCodePackage.Bounds bounds) {
    }
    return -1;
}
 
Example 26
Project: openjdk-jdk10   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public void insert_string(String value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_string)
        throw new TypeMismatch();
    if (value == null)
        throw new InvalidValue();
    // Throw InvalidValue if this is a bounded string and the length is exceeded
    try {
        if (any.type().length() > 0 && any.type().length() < value.length())
            throw new InvalidValue();
    } catch (BadKind bad) { // impossible
    }
    any.insert_string(value);
}
 
Example 27
Project: openjdk-jdk10   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public void insert_wstring(String value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_wstring)
        throw new TypeMismatch();
    if (value == null)
        throw new InvalidValue();
    // Throw InvalidValue if this is a bounded string and the length is exceeded
    try {
        if (any.type().length() > 0 && any.type().length() < value.length())
            throw new InvalidValue();
    } catch (BadKind bad) { // impossible
    }
    any.insert_wstring(value);
}
 
Example 28
Project: openjdk-jdk10   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 29
Project: openjdk9   File: AnyImpl.java   View source code 6 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_string(String s)
{
    //debug.log ("insert_string");
    // Make sure type code information for bounded strings is not erased
    if (typeCode.kind() == TCKind.tk_string) {
        int length = 0;
        try {
            length = typeCode.length();
        } catch (BadKind bad) {
            throw wrapper.badkindCannotOccur() ;
        }

        // Check if bounded strings length is not exceeded
        if (length != 0 && s != null && s.length() > length) {
            throw wrapper.badStringBounds( new Integer(s.length()),
                new Integer(length) ) ;
        }
    } else {
        typeCode = orb.get_primitive_tc(TCKind._tk_string);
    }
    object = s;
    isInitialized = true;
}
 
Example 30
Project: openjdk9   File: AnyImpl.java   View source code 6 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_wstring(String s)
{
    //debug.log ("insert_wstring");
    // Make sure type code information for bounded strings is not erased
    if (typeCode.kind() == TCKind.tk_wstring) {
        int length = 0;
        try {
            length = typeCode.length();
        } catch (BadKind bad) {
            throw wrapper.badkindCannotOccur() ;
        }

        // Check if bounded strings length is not exceeded
        if (length != 0 && s != null && s.length() > length) {
            throw wrapper.badStringBounds( new Integer(s.length()),
                new Integer(length) ) ;
        }
    } else {
        typeCode = orb.get_primitive_tc(TCKind._tk_wstring);
    }
    object = s;
    isInitialized = true;
}
 
Example 31
Project: openjdk9   File: AnyImpl.java   View source code 6 votes vote down vote up
public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type)
{
    try {
        if (TypeCodeImpl.digits(value) > type.fixed_digits() ||
            TypeCodeImpl.scale(value) > type.fixed_scale())
        {
            throw wrapper.fixedNotMatch() ;
        }
    } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
        // type isn't even of kind fixed
        throw wrapper.fixedBadTypecode( bk ) ;
    }
    typeCode = TypeCodeImpl.convertToNative(orb, type);
    object = value;
    isInitialized = true;
}
 
Example 32
Project: openjdk9   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public String name()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().name();
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        return _name;
    default:
        throw new BadKind();
    }
}
 
Example 33
Project: openjdk9   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public int member_count()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_count();
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_value:
        return _memberCount;
    default:
        throw new BadKind();
    }
}
 
Example 34
Project: openjdk9   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public String member_name(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_name(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_value:
        try {
            return _memberNames[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 35
Project: openjdk9   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public TypeCode member_type(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_type(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_value:
        try {
            return _memberTypes[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 36
Project: openjdk9   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public Any member_label(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_label(index);
    case TCKind._tk_union:
        try {
            // _REVISIT_ Why create a new Any for this?
            return new AnyImpl(_orb, _unionLabels[index]);
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 37
Project: openjdk9   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
public TypeCode content_type()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().content_type();
    case TCKind._tk_sequence:
        return lazy_content_type();
    case TCKind._tk_array:
    case TCKind._tk_alias:
    case TCKind._tk_value_box:
        return _contentType;
    default:
        throw new BadKind();
    }
}
 
Example 38
Project: openjdk9   File: TypeCodeImpl.java   View source code 6 votes vote down vote up
int currentUnionMemberIndex(Any discriminatorValue) throws BadKind {
    if (_kind != TCKind._tk_union)
        throw new BadKind();

    try {
        for (int i=0; i<member_count(); i++) {
            if (member_label(i).equal(discriminatorValue)) {
                return i;
            }
        }
        if (_defaultIndex != -1) {
            return _defaultIndex;
        }
    } catch (BadKind bad) {
    } catch (org.omg.CORBA.TypeCodePackage.Bounds bounds) {
    }
    return -1;
}
 
Example 39
Project: openjdk9   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public void insert_string(String value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_string)
        throw new TypeMismatch();
    if (value == null)
        throw new InvalidValue();
    // Throw InvalidValue if this is a bounded string and the length is exceeded
    try {
        if (any.type().length() > 0 && any.type().length() < value.length())
            throw new InvalidValue();
    } catch (BadKind bad) { // impossible
    }
    any.insert_string(value);
}
 
Example 40
Project: openjdk9   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public void insert_wstring(String value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_wstring)
        throw new TypeMismatch();
    if (value == null)
        throw new InvalidValue();
    // Throw InvalidValue if this is a bounded string and the length is exceeded
    try {
        if (any.type().length() > 0 && any.type().length() < value.length())
            throw new InvalidValue();
    } catch (BadKind bad) { // impossible
    }
    any.insert_wstring(value);
}