|
Hi, it is my first message on this forum. Sorry for the bad english, we french canadians are not very good at it.
I Have the URLyBird project with version 1.1.1 specified at the top of my instructions.html document. I don't know if it is a NX: projet.
I have found a way to cast the Exception to a more precise type (SecurityException, RecordNotFoundException...) to respect the throws clauses defined in the DB inteface, but I find it rather ugly, I don't think that this is good design... can anyone suggest me anything better than this:
Note: the DataAccessException is a runtime exception... not mentionned in the DB interface. I use it to inform the client of disk or network IOExceptions... Even if it is a runtime exception, i define it in the throw clause of the methods of the classes that implement the DB interface (for clarity). I think that it was my only choice (using a runtime exception) because some method definitions from the DB interface don't even throw exceptions and it becomes hard to return errors to the client.
Also, I don't think that it would be a good idea to mask IOExceptions as RecordNotFoundException or SecurityException...
SCJP,SCJD,SCWCD,SCBCD,SCDJWS,SCEA
For my first problem, if the NetworkResponse contains an exception, i need to throw it back to the Controler class. And I can't throw it back as an Exception, because it wouldn't match with what is specified in the DB interface (for example, the read method that I provided can only throw RecordNotFoundException according to interface DB). The problem with the proposed solution is that the exception is never returned to the caller. It is dealed with directly in the DataNetworkAdapter. The controler may want to do usefull things with it, like telling the view to warn the user of what appened.
I'm sure glad that he's gone. Now I can read this tiny ad in peace!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|