/** * Convert the given CORBA SystemException that happened during remote access to Spring's * RemoteAccessException if the method signature does not declare RemoteException. Else, return * the SystemException wrapped in a RemoteException. * * @param method the invoked method * @param ex the RemoteException that happened * @return the exception to be thrown to the caller */ private Exception convertCorbaAccessException(SystemException ex, Method method) { if (ReflectionUtils.declaresException(method, RemoteException.class)) { // A traditional RMI service: wrap CORBA exceptions in standard RemoteExceptions. return new RemoteException("Failed to access CORBA service [" + getJndiName() + "]", ex); } else { if (isConnectFailure(ex)) { return new RemoteConnectFailureException( "Could not connect to CORBA service [" + getJndiName() + "]", ex); } else { return new RemoteAccessException( "Could not access CORBA service [" + getJndiName() + "]", ex); } } }