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


Java ActivateFailedException类代码示例

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


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

示例1: testActivateFailedExceptionStringException

import java.rmi.activation.ActivateFailedException; //导入依赖的package包/类
/**
 * Test method for {@link java.rmi.activation.ActivateFailedException#ActivateFailedException(java.lang.String, java.lang.Exception)}.
 */
public void testActivateFailedExceptionStringException() {
    NullPointerException npe = new NullPointerException("npe");
    ActivateFailedException e = new ActivateFailedException("fixture", npe);
    assertTrue(e.getMessage().contains("fixture"));
    assertSame(npe, e.getCause());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:ActivateFailedExceptionTest.java

示例2: newNamingException

import java.rmi.activation.ActivateFailedException; //导入依赖的package包/类
/**
 * Prepares a new {@link NamingException} wrapping the specified
 * {@link RemoteException} source exception. Source exception becomes a
 * {@linkplain NamingException#getCause() cause} of the generated exception.
 * 
 * The particular subclass of {@link NamingException} returned depends on
 * the particular subclass of source {@link RemoteException}.
 * 
 * If source exception is not of a specific class or is not a
 * {@link RemoteException} or is <code>null</code>, then plain
 * {@link NamingException} is returned.
 * 
 * Note: {@link Throwable#fillInStackTrace()} should be called before
 * throwing the generated exception, to provide the proper (not including
 * this method) stack trace for the exception.
 * 
 * Example of use:
 * 
 * <code>try {
 *     ...
 * } catch (RemoteException e) {
 *     throw (NamingException) newNamingException(e).fillInStackTrace();
 * }</code>
 * 
 * @param e
 *            Source {@link RemoteException}.
 * 
 * @return Generated {@link NamingException} exception.
 */
@SuppressWarnings("deprecation")
protected NamingException newNamingException(Throwable e) {
    NamingException ret = (e instanceof AccessException) ? new NoPermissionException()
            : (e instanceof ConnectException) ? new ServiceUnavailableException()
                    : (e instanceof ConnectIOException)
                            || (e instanceof ExportException)
                            || (e instanceof MarshalException)
                            || (e instanceof UnmarshalException) ? new CommunicationException()
                            : (e instanceof ActivateFailedException)
                                    || (e instanceof NoSuchObjectException)
                                    || (e instanceof java.rmi.server.SkeletonMismatchException)
                                    || (e instanceof java.rmi.server.SkeletonNotFoundException)
                                    || (e instanceof StubNotFoundException)
                                    || (e instanceof UnknownHostException) ? new ConfigurationException()
                                    : (e instanceof ServerException) ? newNamingException(e
                                            .getCause())
                                            : new NamingException();

    if (ret.getCause() == null) {
        ret.initCause(e);
    }
    return ret;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:53,代码来源:RegistryContext.java

示例3: testActivateFailedExceptionString

import java.rmi.activation.ActivateFailedException; //导入依赖的package包/类
/**
 * Test method for {@link java.rmi.activation.ActivateFailedException#ActivateFailedException(java.lang.String)}.
 */
public void testActivateFailedExceptionString() {
    ActivateFailedException e = new ActivateFailedException("fixture");
    assertEquals("fixture", e.getMessage());
    assertNull(e.getCause());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:ActivateFailedExceptionTest.java

示例4: newNamingException

import java.rmi.activation.ActivateFailedException; //导入依赖的package包/类
/**
 * Prepares a new {@link NamingException} wrapping the specified
 * {@link RemoteException} source exception. Source exception becomes a
 * {@linkplain NamingException#getCause() cause} of the generated exception.
 *
 * The particular subclass of {@link NamingException} returned depends
 * on the particular subclass of source {@link RemoteException}.
 *
 * If source exception is not of a specific class or is not
 * a {@link RemoteException} or is <code>null</code>,
 * then plain {@link NamingException} is returned.
 *
 * Note: {@link Throwable#fillInStackTrace()} should be called before
 * throwing the generated exception, to provide the proper
 * (not including this method) stack trace for the exception.
 *
 * Example of use:
 *
 * <code>try {
 *     ...
 * } catch (RemoteException e) {
 *     throw (NamingException) newNamingException(e).fillInStackTrace();
 * }</code>
 *
 * @param   e
 *          Source {@link RemoteException}.
 *
 * @return  Generated {@link NamingException} exception.
 */
@SuppressWarnings("deprecation") //$NON-NLS-1$
protected NamingException newNamingException(Throwable e) {
    NamingException ret =
              (e instanceof AccessException)
                    ? new NoPermissionException()
            : (e instanceof ConnectException)
                    ? new ServiceUnavailableException()
            : (e instanceof ConnectIOException)
           || (e instanceof ExportException)
           || (e instanceof MarshalException)
           || (e instanceof UnmarshalException)
                    ? new CommunicationException()
            : (e instanceof ActivateFailedException)
           || (e instanceof NoSuchObjectException)
           || (e instanceof java.rmi.server.SkeletonMismatchException)
           || (e instanceof java.rmi.server.SkeletonNotFoundException)
           || (e instanceof StubNotFoundException)
           || (e instanceof UnknownHostException)
                    ? new ConfigurationException()
            : (e instanceof ServerException)
                    ? newNamingException(e.getCause())
                    : new NamingException();

    if (ret.getCause() == null) {
        ret.initCause(e);
    }
    return ret;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:58,代码来源:RegistryContext.java


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