Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: Exceptions vs interface specs

 
Jaco Bekker
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all...

I've implemented the Data class which implements the DBMain interface from the assignment specs. It specifies the following prototype for the create method:

public int create(String [] data) throws DuplicateKeyException;

My problem is that the RandomAccessFile object throws an IOException but that the create method can't pass to the caller (only DuplicateKeyException).

How do i handle the IOException(s) in the Database?

Thanx

Jaco Bekker

SJCP 1.4
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hehe, common headbreaker.

You can either find a way to handle them inside the Data class (which is unlikely to work) or throw some sort of RuntimeException wrapping the thing instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic