hi,all
In my design, I thougt that all the exception, including all sorts of database operation exception and IOException should be passed to client GUI and handled. But in my DB interface, the exception thrown from method have been definitely restricted, such as:
public
String[] read(int recNo) throws RecordNotFoundException;
public void update(int recNo, String[] data, long lockCookie)
throws RecordNotFoundException, SecurityException;
public int[] find(String[] criteria); public int create(String[] data) throws DuplicateKeyException;
public void unlock(int recNo, long cookie)
throws RecordNotFoundException, SecurityException;
Thus, the methods within my implemented class of DB interface (Data class), has to abide the rule of thrown exception, which are regulated by DB interface.
My question is how I can capture and throw the IOException in methods of Data class? It seems that the only thing which I can do is capturing the IOException and re-throwing a database operation exception(RecordNotFoundException, SecurityException,etc). However,the SUN's requirements has definitely state each database operatio exception should be thrown under different circumstances. For example, in requirement there is a sentence:
"Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file." Especially in find() method, which does not throw any exceptions. All the IO exceptions have to be captuered and handled within this method when calling this method.
Can somebody give me a help clew about what to do?
Thanks in advance!
Robert