/** * Wraps an exception thrown by an implementation method. It returns the corresponding client-side exception. * * @param orig * the exception to wrap. * @return the wrapped exception. */ public RemoteException wrapException(Throwable orig) { if (orig instanceof SystemException) { return mapSystemException((SystemException) orig); } if (orig instanceof Error) { return new ServerError("Error occurred in server thread", (Error) orig); } else if (orig instanceof RemoteException) { return new ServerException("RemoteException occurred in server thread", (Exception) orig); } else if (orig instanceof RuntimeException) { throw (RuntimeException) orig; } if (orig instanceof Exception) return new UnexpectedException(orig.toString(), (Exception) orig); else return new UnexpectedException(orig.toString()); }
/** * Wraps an exception thrown by an implementation method. It returns the corresponding client-side exception. * * @param orig * the exception to wrap. * @return the wrapped exception. */ public RemoteException wrapException(Throwable orig) { if (orig instanceof SystemException) { return mapSystemException((SystemException) orig); } if (orig instanceof Error) { return new ServerError("Error occurred in server thread", (Error) orig); } else if (orig instanceof RemoteException) { return new ServerException("RemoteException occurred in server thread", (Exception) orig); } else if (orig instanceof RuntimeException) { throw (RuntimeException) orig; } if (orig instanceof Exception) return new UnexpectedException(orig.toString(), (Exception) orig); else return new UnexpectedException(orig.toString()); }