org.omg.CORBA.TypeCodePackage.BadKind Java Examples

The following examples show how to use org.omg.CORBA.TypeCodePackage.BadKind. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnyImpl.java    From jdk8u60 with GNU General Public License v2.0 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
Source File: TypeCodeImpl.java    From jdk1.8-source-analysis with Apache License 2.0 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 #3
Source File: TypeCodeImpl.java    From jdk1.8-source-analysis with Apache License 2.0 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 #4
Source File: AnyImpl.java    From TencentKona-8 with GNU General Public License v2.0 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 #5
Source File: AnyImpl.java    From TencentKona-8 with GNU General Public License v2.0 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 #6
Source File: TypeCodeImpl.java    From TencentKona-8 with GNU General Public License v2.0 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 #7
Source File: AnyImpl.java    From JDKSourceCode1.8 with MIT License 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 #8
Source File: TypeCodeImpl.java    From TencentKona-8 with GNU General Public License v2.0 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 #9
Source File: TypeCodeImpl.java    From TencentKona-8 with GNU General Public License v2.0 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 #10
Source File: TypeCodeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 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 #11
Source File: DynAnyBasicImpl.java    From JDKSourceCode1.8 with MIT License 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 #12
Source File: TypeCodeImpl.java    From TencentKona-8 with GNU General Public License v2.0 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 #13
Source File: DynAnyBasicImpl.java    From TencentKona-8 with GNU General Public License v2.0 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 #14
Source File: DynAnyBasicImpl.java    From TencentKona-8 with GNU General Public License v2.0 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 #15
Source File: CDROutputStream_1_0.java    From TencentKona-8 with GNU General Public License v2.0 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 #16
Source File: AnyImpl.java    From jdk1.8-source-analysis with Apache License 2.0 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
Source File: DynAnyBasicImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 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 #18
Source File: TypeCodeImpl.java    From jdk8u60 with GNU General Public License v2.0 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
Source File: TypeCodeImpl.java    From JDKSourceCode1.8 with MIT License 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 #20
Source File: TypeCodeImpl.java    From jdk8u60 with GNU General Public License v2.0 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
Source File: TypeCodeImpl.java    From JDKSourceCode1.8 with MIT License 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
Source File: TypeCodeImpl.java    From jdk8u60 with GNU General Public License v2.0 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
Source File: TypeCodeImpl.java    From jdk8u60 with GNU General Public License v2.0 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
Source File: AnyImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 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 #25
Source File: TypeCodeImpl.java    From JDKSourceCode1.8 with MIT License 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 #26
Source File: TypeCodeImpl.java    From JDKSourceCode1.8 with MIT License 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 #27
Source File: AnyImpl.java    From JDKSourceCode1.8 with MIT License 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 #28
Source File: DynAnyBasicImpl.java    From jdk8u60 with GNU General Public License v2.0 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 #29
Source File: DynAnyBasicImpl.java    From JDKSourceCode1.8 with MIT License 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 #30
Source File: CDROutputStream_1_0.java    From jdk8u60 with GNU General Public License v2.0 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);
    }
}