/** * 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()); }
/** * 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; }
/** * 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()); }
/** * 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; }