Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLY bird, Exception handling problem

 
ghanshyam sharma
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have an idea regarding this.
The assignment mentions a set of methods as the interface that one MUST implement. Is it possible to add some exceptions to the throw clause of the interface methods without loosing any marks ???
Here is the reason. Using I am trying to have the RMI server s well as the local server return the server class with the same interface which the client can use invisibely. which means I am trying to use the same interface to build my Remote Server as well the local database class. The problem is that using RMI, the remote server implementation needs to throw RemoteException for every interface method that it implements.
Now if I am using the same base interface, the base interface should also throw RemoteException.
If I do not go this way I will have to return different type of objects in case of remote server implementation as compared to teh local server implementation which doesn't sound very good to me ...
Only way is to change the interface and add something like java.io.IOException to every method. Now since RemoteException is a subclass of IOException, I will be able to use the same interface for both local implementation and the remote implementation. My only doubt is does this voilate the MUST condition in the requirement spec ???
Thanks in advance...
-Sharma
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My only doubt is does this voilate the MUST condition

I decided not to take a challage. There are many different solutions.
Nobody says that this interface must be used by GUI client. So I use
adapter pattern to provide another high-level interface with all exceptions
and method signatures my GUI client need.
Vlad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic