Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IOException

 
Steve Harper
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would it make sense to modify the DatabaseException so that it extended IOException. That way you could declare the DataInterface methods so that they only threw IOException instead of both RemoteException and DatabaseException.
The reason I say this is at the moment the client has to have code to deal with RemoteExceptions even when running in local mode when they would never be thrown.
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The reason I say this is at the moment the client has to have code to deal with RemoteExceptions even when running in local mode when they would never be thrown.

Your client may throw a subset of exceptions in the interface.
Eugene.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And in the remote implemetation of your interface, you can wrap these RemoteExceptions into a DataBaseException and throw that instead so that your client only needs to catch DataBaseExceptions.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic