Should local exceptions be wrapped in RemoteException with RMI?
I am trying to understand the reason why all remote methods have the possibility of throwing a RemoteException.
I am currently doing something like this:publicinterface RemoteReaderextends Remote{
public String readData(File f)throws IOException, RemoteException;
}
Should I be doing something like:publicinterface RemoteReaderextends Remote{
public String readData(File f)throws RemoteException;//no IOException
}
publicclass RemoteReaderImplimplements RemoteReader{
public String readData(File f)throws RemoteException{
try{
//some code that may throw an IOException
}catch (IOException e){
thrownew RemoteException(e.getMessage(), e);
}
}
}
Which is preferred?

