当前位置: 首页>>代码示例>>Java>>正文


Java UserException类代码示例

本文整理汇总了Java中org.omg.CORBA.UserException的典型用法代码示例。如果您正苦于以下问题:Java UserException类的具体用法?Java UserException怎么用?Java UserException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UserException类属于org.omg.CORBA包,在下文中一共展示了UserException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSystemException

import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
 * Test catching the system exception, thrown on the remote side.
 */
public void testSystemException()
{
  System.out.println("**** Test system exception:");
  try
    {
      // Negative parameter = system exception.
      object.throwException(-55);
    }
  catch (BAD_OPERATION ex)
    {
      System.out.println("  The expected BAD_OPERATION, minor code " +
                         ex.minor + ", has been thrown on remote side."
                        );
    }
  catch (UserException uex)
    {
      throw new InternalError();
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:23,代码来源:DirectTest.java

示例2: create_dyn_any

import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:24,代码来源:gnuDynAnyFactory.java

示例3: readUserException

import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
 * Reads the user exception, having the given Id, from the input stream. The
 * id is expected to be in the form like
 * 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
 *
 * @param idl the exception idl name.
 * @param input the stream to read from.
 *
 * @return the loaded exception.
 * @return null if the helper class cannot be found.
 */
public static UserException readUserException(String idl, InputStream input)
{
  try
    {
      Class helperClass = findHelper(idl);

      Method read = helperClass.getMethod("read",
        new Class[] { org.omg.CORBA.portable.InputStream.class });

      return (UserException) read.invoke(null, new Object[] { input });
    }
  catch (MARSHAL mex)
    {
      // This one is ok to throw
      throw mex;
    }
  catch (Exception ex)
    {
      ex.printStackTrace();
      return null;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:34,代码来源:ObjectCreator.java

示例4: readUserException

import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
 * Reads the user exception, having the given Id, from the input stream. The
 * id is expected to be in the form like
 * 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
 * 
 * @param idl the exception idl name.
 * @param input the stream to read from.
 * 
 * @return the loaded exception.
 * @return null if the helper class cannot be found.
 */
public static UserException readUserException(String idl, InputStream input)
{
  try
    {
      Class helperClass = findHelper(idl);

      Method read = helperClass.getMethod("read",
        new Class[] { org.omg.CORBA.portable.InputStream.class });

      return (UserException) read.invoke(null, new Object[] { input });
    }
  catch (MARSHAL mex)
    {
      // This one is ok to throw
      throw mex;
    }
  catch (Exception ex)
    {
      ex.printStackTrace();
      return null;
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:34,代码来源:ObjectCreator.java

示例5: createSSLTaggedComponent

import org.omg.CORBA.UserException; //导入依赖的package包/类
private void createSSLTaggedComponent(IIOPProfileTemplate profileTemplate, int port) throws UserException
{
    SSL ssl = new SSL();
    ssl.port = (short) port;

    short sslOptions = Integrity.value | Confidentiality.value | DetectMisordering.value | DetectReplay.value
            | EstablishTrustInTarget.value | EstablishTrustInClient.value;
    ssl.target_supports = sslOptions;
    ssl.target_requires = sslOptions;

    GIOPVersion giopVersion = orb.getORBData().getGIOPVersion();
    CDREncapsCodec codec = new CDREncapsCodec(orb, giopVersion.getMajor(),giopVersion.getMinor());

    Any any = orb.create_any();
    SSLHelper.insert(any, ssl);
    byte[] componentData = codec.encode_value(any);

    TaggedComponent sslTaggedComponent = new TaggedComponent(TAG_SSL_SEC_TRANS.value, componentData);

    TaggedComponentFactoryFinder finder =
            orb.getTaggedComponentFactoryFinder();
    Object newTaggedComponent = finder.create( orb, sslTaggedComponent);

    profileTemplate.add(newTaggedComponent);
}
 
开发者ID:jboss,项目名称:openjdk-orb,代码行数:26,代码来源:INSURLOperationImpl.java

示例6: write_TypeCode

import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
 * Write the TypeCode. This implementation delegates functionality
 * to {@link cdrTypeCode}.
 *
 * @param x a TypeCode to write.
 */
public void write_TypeCode(TypeCode x)
{
  try
    {
      TypeCodeHelper.write(this, x);
    }
  catch (UserException ex)
    {
      Unexpected.error(ex);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:AbstractCdrOutput.java

示例7: checkTypePossibility

import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
 * Checks if the given type can be encoded. Currently only checks for wide
 * strings and wide chars for GIOP 1.0.
 *
 * @param t a typecode to chek.
 *
 * @throws InvalidTypeForEncoding if the typecode is not valid for the given
 * version.
 */
private void checkTypePossibility(String name, TypeCode t)
                           throws InvalidTypeForEncoding
{
  if (noWide)
    {
      try
        {
          int kind = t.kind().value();

          if (kind == TCKind._tk_wchar || kind == TCKind._tk_wstring)
            throw new InvalidTypeForEncoding(name + " wide char in " +
                                             version
                                            );
          else if (kind == TCKind._tk_alias || kind == TCKind._tk_array ||
                   kind == TCKind._tk_sequence
                  )
            checkTypePossibility("Array member", t.content_type());

          else if (kind == TCKind._tk_struct || kind == TCKind._tk_union)
            {
              for (int i = 0; i < t.member_count(); i++)
                {
                  checkTypePossibility(t.member_name(i), t.member_type(i));
                }
            }
        }
      catch (UserException ex)
        {
          InternalError ierr = new InternalError();
          ierr.initCause(ex);
          throw ierr;
        }
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:44,代码来源:CdrEncapsCodecImpl.java

示例8: insertException

import org.omg.CORBA.UserException; //导入依赖的package包/类
/**
 * Insert this exception into the given Any. On failure, insert the UNKNOWN
 * exception.
 */
public static void insertException(Any into, Throwable exception)
{
  boolean ok = false;
  if (exception instanceof SystemException)
    ok = insertSysException(into, (SystemException) exception);
  else if (exception instanceof UserException)
    ok = insertWithHelper(into, exception);

  if (!ok)
    ok = insertSysException(into, new UNKNOWN());
  if (!ok)
    throw new InternalError("Exception wrapping broken");
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:ObjectCreator.java

示例9: export

import org.omg.CORBA.UserException; //导入依赖的package包/类
public Object export(Remote server, Class<?> remoteClass)
  throws RemoteException
{
  try {
    PortableRemoteObject.exportObject(server);
    POA poa = getPOA();
    Object servant = Util.getTie(server);
    Object ref = poa.servant_to_reference((Servant)servant);
    return PortableRemoteObject.narrow(ref, remoteClass);
  } catch(UserException e) {
    throw new ExportException("could not export corba stream servant", e);
  }
}
 
开发者ID:jahlborn,项目名称:rmiio,代码行数:14,代码来源:IIOPRemoteStreamExporter.java

示例10: invokeClientPIStartingPoint

import org.omg.CORBA.UserException; //导入依赖的package包/类
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:PIHandlerImpl.java

示例11: raise_exception_with_list

import org.omg.CORBA.UserException; //导入依赖的package包/类
public void raise_exception_with_list(org.omg.CORBA.TypeCode[] exc_list)
    throws org.omg.CORBA.UserException
{
    throw new NO_IMPLEMENT();
}
 
开发者ID:AlvaroVega,项目名称:TIDorbJ,代码行数:6,代码来源:_ExceptionHolderImpl.java


注:本文中的org.omg.CORBA.UserException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。