• 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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!