Java Code Examples for org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode

The following are top voted examples for showing how to use org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode. 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: DynUnionImpl.java   View source code 6 votes vote down vote up
public void set_to_default_member ()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int defaultIndex = defaultIndex();
    if (defaultIndex == -1) {
        throw new TypeMismatch();
    }
    try {
        clearData();
        index = 1;
        currentMemberIndex = defaultIndex;
        currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
        components = new DynAny[] {discriminator, currentMember};
        Any discriminatorAny = orb.create_any();
        discriminatorAny.insert_octet((byte)0);
        discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
        representations = REPRESENTATION_COMPONENTS;
    } catch (InconsistentTypeCode ictc) {}
}
 
Example 2
Project: OpenJSharp   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    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_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 3
Project: openjdk-jdk10   File: DynUnionImpl.java   View source code 6 votes vote down vote up
public void set_to_default_member ()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int defaultIndex = defaultIndex();
    if (defaultIndex == -1) {
        throw new TypeMismatch();
    }
    try {
        clearData();
        index = 1;
        currentMemberIndex = defaultIndex;
        currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
        components = new DynAny[] {discriminator, currentMember};
        Any discriminatorAny = orb.create_any();
        discriminatorAny.insert_octet((byte)0);
        discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
        representations = REPRESENTATION_COMPONENTS;
    } catch (InconsistentTypeCode ictc) {}
}
 
Example 4
Project: openjdk-jdk10   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    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_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 5
Project: openjdk9   File: DynUnionImpl.java   View source code 6 votes vote down vote up
public void set_to_default_member ()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int defaultIndex = defaultIndex();
    if (defaultIndex == -1) {
        throw new TypeMismatch();
    }
    try {
        clearData();
        index = 1;
        currentMemberIndex = defaultIndex;
        currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
        components = new DynAny[] {discriminator, currentMember};
        Any discriminatorAny = orb.create_any();
        discriminatorAny.insert_octet((byte)0);
        discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
        representations = REPRESENTATION_COMPONENTS;
    } catch (InconsistentTypeCode ictc) {}
}
 
Example 6
Project: openjdk9   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    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_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 7
Project: lookaside_java-1.8.0-openjdk   File: DynUnionImpl.java   View source code 6 votes vote down vote up
public void set_to_default_member ()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int defaultIndex = defaultIndex();
    if (defaultIndex == -1) {
        throw new TypeMismatch();
    }
    try {
        clearData();
        index = 1;
        currentMemberIndex = defaultIndex;
        currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
        components = new DynAny[] {discriminator, currentMember};
        Any discriminatorAny = orb.create_any();
        discriminatorAny.insert_octet((byte)0);
        discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
        representations = REPRESENTATION_COMPONENTS;
    } catch (InconsistentTypeCode ictc) {}
}
 
Example 8
Project: lookaside_java-1.8.0-openjdk   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    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_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 9
Project: jdk8u_corba   File: DynUnionImpl.java   View source code 6 votes vote down vote up
public void set_to_default_member ()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int defaultIndex = defaultIndex();
    if (defaultIndex == -1) {
        throw new TypeMismatch();
    }
    try {
        clearData();
        index = 1;
        currentMemberIndex = defaultIndex;
        currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
        components = new DynAny[] {discriminator, currentMember};
        Any discriminatorAny = orb.create_any();
        discriminatorAny.insert_octet((byte)0);
        discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
        representations = REPRESENTATION_COMPONENTS;
    } catch (InconsistentTypeCode ictc) {}
}
 
Example 10
Project: jdk8u_corba   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    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_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 11
Project: javify   File: gnuDynAnyFactory.java   View source code 6 votes vote down vote up
/**
 * Create the DynAny using the passed value as template and assign this value.
 */
public DynAny create_dyn_any(Any value)
                      throws InconsistentTypeCode
{
  DynAny created = create_dyn_any_from_type_code(value.type());
  try
    {
      created.from_any(value);
    }
  catch (UserException uex)
    {
      InconsistentTypeCode t = new InconsistentTypeCode("Inconsistent Any");
      t.initCause(uex);
      throw t;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
  return created;
}
 
Example 12
Project: javify   File: gnuDynValueBox.java   View source code 6 votes vote down vote up
/** @inheritDoc */
public void set_to_value()
{
  try
    {
      if (array.length == 0)
        {
          array =
            new DynAny[] { factory.create_dyn_any_from_type_code(content) };
        }
    }
  catch (InconsistentTypeCode e)
    {
      throw new Unexpected(e);
    }
  valueChanged();
}
 
Example 13
Project: javify   File: gnuDynArray.java   View source code 6 votes vote down vote up
/**
 * Set elements when array of ordinary anys is provided.
 */
public void set_elements(Any[] value)
                  throws InvalidValue, TypeMismatch
{
  if (value.length != array.length)
    throw new InvalidValue(sizeMismatch(array.length, value.length));

  for (int i = 0; i < value.length; i++)
    {
      checkType(official_components, value [ i ].type());
      try
        {
          array [ i ] = factory.create_dyn_any(value [ i ]);
        }
      catch (InconsistentTypeCode e)
        {
          TypeMismatch t = new TypeMismatch();
          t.initCause(e);
          throw t;
        }
    }
  pos = 0;
  valueChanged();
}
 
Example 14
Project: javify   File: gnuDynUnion.java   View source code 6 votes vote down vote up
/**
 * Create a new instance with the given typecode.
 *
 * @param aType the final_type, must be final_type of the union.
 */
public gnuDynUnion(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory,
                   ORB anOrb
                  )
            throws InconsistentTypeCode
{
  super(oType, aType, aFactory, anOrb);
  try
    {
      discriminator =
        factory.create_dyn_any_from_type_code(final_type.discriminator_type());

      ((AbstractAny) discriminator).listener = this;

      if (final_type.default_index() >= 0)
        set_to_default_member();
      else
        set_to_no_active_member();
    }
  catch (Exception ex)
    {
      InconsistentTypeCode inc = new InconsistentTypeCode("discriminator");
      inc.initCause(ex);
      throw inc;
    }
}
 
Example 15
Project: javify   File: gnuDynUnion.java   View source code 6 votes vote down vote up
/** @inheritDoc */
public DynAny copy()
{
  try
    {
      gnuDynUnion other =
        new gnuDynUnion(official_type, final_type, factory, orb);
      other.discriminator = discriminator.copy();
      ((AbstractAny) other.discriminator).listener = other;
      if (array.length == 1)
        {
          other.array = new DynAny[] { other.discriminator };
        }
      else
        {
          other.array =
            new DynAny[] { other.discriminator, array [ 1 ].copy() };
        }
      return other;
    }
  catch (InconsistentTypeCode ex)
    {
      throw new Unexpected(ex);
    }
}
 
Example 16
Project: jvm-stm   File: gnuDynAnyFactory.java   View source code 6 votes vote down vote up
/**
 * Create the DynAny using the passed value as template and assign this value.
 */
public DynAny create_dyn_any(Any value)
                      throws InconsistentTypeCode
{
  DynAny created = create_dyn_any_from_type_code(value.type());
  try
    {
      created.from_any(value);
    }
  catch (UserException uex)
    {
      InconsistentTypeCode t = new InconsistentTypeCode("Inconsistent Any");
      t.initCause(uex);
      throw t;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
  return created;
}
 
Example 17
Project: jvm-stm   File: gnuDynValueBox.java   View source code 6 votes vote down vote up
/** @inheritDoc */
public void set_to_value()
{
  try
    {
      if (array.length == 0)
        {
          array =
            new DynAny[] { factory.create_dyn_any_from_type_code(content) };
        }
    }
  catch (InconsistentTypeCode e)
    {
      throw new Unexpected(e);
    }
  valueChanged();
}
 
Example 18
Project: jvm-stm   File: gnuDynArray.java   View source code 6 votes vote down vote up
/**
 * Set elements when array of ordinary anys is provided.
 */
public void set_elements(Any[] value)
                  throws InvalidValue, TypeMismatch
{
  if (value.length != array.length)
    throw new InvalidValue(sizeMismatch(array.length, value.length));

  for (int i = 0; i < value.length; i++)
    {
      checkType(official_components, value [ i ].type());
      try
        {
          array [ i ] = factory.create_dyn_any(value [ i ]);
        }
      catch (InconsistentTypeCode e)
        {
          TypeMismatch t = new TypeMismatch();
          t.initCause(e);
          throw t;
        }
    }
  pos = 0;
  valueChanged();
}
 
Example 19
Project: jvm-stm   File: gnuDynUnion.java   View source code 6 votes vote down vote up
/**
 * Create a new instance with the given typecode.
 *
 * @param aType the final_type, must be final_type of the union.
 */
public gnuDynUnion(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory,
                   ORB anOrb
                  )
            throws InconsistentTypeCode
{
  super(oType, aType, aFactory, anOrb);
  try
    {
      discriminator =
        factory.create_dyn_any_from_type_code(final_type.discriminator_type());

      ((AbstractAny) discriminator).listener = this;

      if (final_type.default_index() >= 0)
        set_to_default_member();
      else
        set_to_no_active_member();
    }
  catch (Exception ex)
    {
      InconsistentTypeCode inc = new InconsistentTypeCode("discriminator");
      inc.initCause(ex);
      throw inc;
    }
}
 
Example 20
Project: jvm-stm   File: gnuDynUnion.java   View source code 6 votes vote down vote up
/** @inheritDoc */
public DynAny copy()
{
  try
    {
      gnuDynUnion other =
        new gnuDynUnion(official_type, final_type, factory, orb);
      other.discriminator = discriminator.copy();
      ((AbstractAny) other.discriminator).listener = other;
      if (array.length == 1)
        {
          other.array = new DynAny[] { other.discriminator };
        }
      else
        {
          other.array =
            new DynAny[] { other.discriminator, array [ 1 ].copy() };
        }
      return other;
    }
  catch (InconsistentTypeCode ex)
    {
      throw new Unexpected(ex);
    }
}
 
Example 21
Project: infobip-open-jdk-8   File: DynUnionImpl.java   View source code 6 votes vote down vote up
public void set_to_default_member ()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int defaultIndex = defaultIndex();
    if (defaultIndex == -1) {
        throw new TypeMismatch();
    }
    try {
        clearData();
        index = 1;
        currentMemberIndex = defaultIndex;
        currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
        components = new DynAny[] {discriminator, currentMember};
        Any discriminatorAny = orb.create_any();
        discriminatorAny.insert_octet((byte)0);
        discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
        representations = REPRESENTATION_COMPONENTS;
    } catch (InconsistentTypeCode ictc) {}
}
 
Example 22
Project: infobip-open-jdk-8   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    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_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 23
Project: openjdk-source-code-learn   File: DynUnionImpl.java   View source code 6 votes vote down vote up
public void set_to_default_member ()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int defaultIndex = defaultIndex();
    if (defaultIndex == -1) {
        throw new TypeMismatch();
    }
    try {
        clearData();
        index = 1;
        currentMemberIndex = defaultIndex;
        currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
        components = new DynAny[] {discriminator, currentMember};
        Any discriminatorAny = orb.create_any();
        discriminatorAny.insert_octet((byte)0);
        discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
        representations = REPRESENTATION_COMPONENTS;
    } catch (InconsistentTypeCode ictc) {}
}
 
Example 24
Project: openjdk-source-code-learn   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    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_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 25
Project: OLD-OpenJDK8   File: DynUnionImpl.java   View source code 6 votes vote down vote up
public void set_to_default_member ()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int defaultIndex = defaultIndex();
    if (defaultIndex == -1) {
        throw new TypeMismatch();
    }
    try {
        clearData();
        index = 1;
        currentMemberIndex = defaultIndex;
        currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
        components = new DynAny[] {discriminator, currentMember};
        Any discriminatorAny = orb.create_any();
        discriminatorAny.insert_octet((byte)0);
        discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
        representations = REPRESENTATION_COMPONENTS;
    } catch (InconsistentTypeCode ictc) {}
}
 
Example 26
Project: OLD-OpenJDK8   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    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_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 27
Project: JamVM-PH   File: gnuDynAnyFactory.java   View source code 6 votes vote down vote up
/**
 * Create the DynAny using the passed value as template and assign this value.
 */
public DynAny create_dyn_any(Any value)
                      throws InconsistentTypeCode
{
  DynAny created = create_dyn_any_from_type_code(value.type());
  try
    {
      created.from_any(value);
    }
  catch (UserException uex)
    {
      InconsistentTypeCode t = new InconsistentTypeCode("Inconsistent Any");
      t.initCause(uex);
      throw t;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
  return created;
}
 
Example 28
Project: JamVM-PH   File: gnuDynValueBox.java   View source code 6 votes vote down vote up
/** @inheritDoc */
public void set_to_value()
{
  try
    {
      if (array.length == 0)
        {
          array =
            new DynAny[] { factory.create_dyn_any_from_type_code(content) };
        }
    }
  catch (InconsistentTypeCode e)
    {
      throw new Unexpected(e);
    }
  valueChanged();
}
 
Example 29
Project: JamVM-PH   File: gnuDynArray.java   View source code 6 votes vote down vote up
/**
 * Set elements when array of ordinary anys is provided.
 */
public void set_elements(Any[] value)
                  throws InvalidValue, TypeMismatch
{
  if (value.length != array.length)
    throw new InvalidValue(sizeMismatch(array.length, value.length));

  for (int i = 0; i < value.length; i++)
    {
      checkType(official_components, value [ i ].type());
      try
        {
          array [ i ] = factory.create_dyn_any(value [ i ]);
        }
      catch (InconsistentTypeCode e)
        {
          TypeMismatch t = new TypeMismatch();
          t.initCause(e);
          throw t;
        }
    }
  pos = 0;
  valueChanged();
}
 
Example 30
Project: JamVM-PH   File: gnuDynUnion.java   View source code 6 votes vote down vote up
/**
 * Create a new instance with the given typecode.
 *
 * @param aType the final_type, must be final_type of the union.
 */
public gnuDynUnion(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory,
                   ORB anOrb
                  )
            throws InconsistentTypeCode
{
  super(oType, aType, aFactory, anOrb);
  try
    {
      discriminator =
        factory.create_dyn_any_from_type_code(final_type.discriminator_type());

      ((AbstractAny) discriminator).listener = this;

      if (final_type.default_index() >= 0)
        set_to_default_member();
      else
        set_to_no_active_member();
    }
  catch (Exception ex)
    {
      InconsistentTypeCode inc = new InconsistentTypeCode("discriminator");
      inc.initCause(ex);
      throw inc;
    }
}
 
Example 31
Project: JamVM-PH   File: gnuDynUnion.java   View source code 6 votes vote down vote up
/** @inheritDoc */
public DynAny copy()
{
  try
    {
      gnuDynUnion other =
        new gnuDynUnion(official_type, final_type, factory, orb);
      other.discriminator = discriminator.copy();
      ((AbstractAny) other.discriminator).listener = other;
      if (array.length == 1)
        {
          other.array = new DynAny[] { other.discriminator };
        }
      else
        {
          other.array =
            new DynAny[] { other.discriminator, array [ 1 ].copy() };
        }
      return other;
    }
  catch (InconsistentTypeCode ex)
    {
      throw new Unexpected(ex);
    }
}
 
Example 32
Project: openjdk-orb   File: DynUnionImpl.java   View source code 6 votes vote down vote up
public void set_to_default_member ()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int defaultIndex = defaultIndex();
    if (defaultIndex == -1) {
        throw new TypeMismatch();
    }
    try {
        clearData();
        index = 1;
        currentMemberIndex = defaultIndex;
        currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
        components = new DynAny[] {discriminator, currentMember};
        Any discriminatorAny = orb.create_any();
        discriminatorAny.insert_octet((byte)0);
        discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
        representations = REPRESENTATION_COMPONENTS;
    } catch (InconsistentTypeCode ictc) {}
}
 
Example 33
Project: openjdk-orb   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    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_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 34
Project: classpath   File: gnuDynAnyFactory.java   View source code 6 votes vote down vote up
/**
 * Create the DynAny using the passed value as template and assign this value.
 */
public DynAny create_dyn_any(Any value)
                      throws InconsistentTypeCode
{
  DynAny created = create_dyn_any_from_type_code(value.type());
  try
    {
      created.from_any(value);
    }
  catch (UserException uex)
    {
      InconsistentTypeCode t = new InconsistentTypeCode("Inconsistent Any");
      t.initCause(uex);
      throw t;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
  return created;
}
 
Example 35
Project: classpath   File: gnuDynValueBox.java   View source code 6 votes vote down vote up
/** @inheritDoc */
public void set_to_value()
{
  try
    {
      if (array.length == 0)
        {
          array =
            new DynAny[] { factory.create_dyn_any_from_type_code(content) };
        }
    }
  catch (InconsistentTypeCode e)
    {
      throw new Unexpected(e);
    }
  valueChanged();
}
 
Example 36
Project: classpath   File: gnuDynArray.java   View source code 6 votes vote down vote up
/**
 * Set elements when array of ordinary anys is provided.
 */
public void set_elements(Any[] value)
                  throws InvalidValue, TypeMismatch
{
  if (value.length != array.length)
    throw new InvalidValue(sizeMismatch(array.length, value.length));

  for (int i = 0; i < value.length; i++)
    {
      checkType(official_components, value [ i ].type());
      try
        {
          array [ i ] = factory.create_dyn_any(value [ i ]);
        }
      catch (InconsistentTypeCode e)
        {
          TypeMismatch t = new TypeMismatch();
          t.initCause(e);
          throw t;
        }
    }
  pos = 0;
  valueChanged();
}
 
Example 37
Project: classpath   File: gnuDynUnion.java   View source code 6 votes vote down vote up
/**
 * Create a new instance with the given typecode.
 *
 * @param aType the final_type, must be final_type of the union.
 */
public gnuDynUnion(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory,
                   ORB anOrb
                  )
            throws InconsistentTypeCode
{
  super(oType, aType, aFactory, anOrb);
  try
    {
      discriminator =
        factory.create_dyn_any_from_type_code(final_type.discriminator_type());

      ((AbstractAny) discriminator).listener = this;

      if (final_type.default_index() >= 0)
        set_to_default_member();
      else
        set_to_no_active_member();
    }
  catch (Exception ex)
    {
      InconsistentTypeCode inc = new InconsistentTypeCode("discriminator");
      inc.initCause(ex);
      throw inc;
    }
}
 
Example 38
Project: classpath   File: gnuDynUnion.java   View source code 6 votes vote down vote up
/** @inheritDoc */
public DynAny copy()
{
  try
    {
      gnuDynUnion other =
        new gnuDynUnion(official_type, final_type, factory, orb);
      other.discriminator = discriminator.copy();
      ((AbstractAny) other.discriminator).listener = other;
      if (array.length == 1)
        {
          other.array = new DynAny[] { other.discriminator };
        }
      else
        {
          other.array =
            new DynAny[] { other.discriminator, array [ 1 ].copy() };
        }
      return other;
    }
  catch (InconsistentTypeCode ex)
    {
      throw new Unexpected(ex);
    }
}
 
Example 39
Project: openjdk-icedtea7   File: DynUnionImpl.java   View source code 6 votes vote down vote up
public void set_to_default_member ()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int defaultIndex = defaultIndex();
    if (defaultIndex == -1) {
        throw new TypeMismatch();
    }
    try {
        clearData();
        index = 1;
        currentMemberIndex = defaultIndex;
        currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
        components = new DynAny[] {discriminator, currentMember};
        Any discriminatorAny = orb.create_any();
        discriminatorAny.insert_octet((byte)0);
        discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
        representations = REPRESENTATION_COMPONENTS;
    } catch (InconsistentTypeCode ictc) {}
}
 
Example 40
Project: openjdk-icedtea7   File: DynAnyBasicImpl.java   View source code 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    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_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}