本文整理汇总了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());
}
示例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;
}
示例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());
}
示例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;
}