Originally posted by Sai Prasad:
Yes. In my submission, all the methods in Data threw DatabaseException and the RMI remote object threw only RemoteException encapsulating the DatabaseException in it.
[ June 01, 2002: Message edited by: Sai Prasad ]
Steven
I can understand only throwing DatabaseException from Data but I'd argue that you should still throw DatabaseException from the RMI object. I'd leave RemoteExecption to be raised by the stub due to network problems.
Originally posted by dean tomlinson:
actually - do you think I can be penalised for not using 1.4, now it is widely available, especially as the Exception Chaning comes for free in that release ?
also - Steve - are you the Steve Sloggett from Plymouth Uni - Computing and Informatics ?
Steven
I wonder, though, if we should change the exceptions. My reason is that the requirements don't ask for any code cleanup (apart from deprecated methods), and if you were to decide to clean the code, then there's unused variables to remove, misleading comments to correct and much more... I'm not sure that the marker would expect us to go down that path?
Originally posted by dean tomlinson:
'kin ell - it is a small world.
did you go back to ibm after uni ? still seeing emma hardy ? where do you live ? - i'm down in bournemouth, working on vodafone's e-commerce site.
how far have you got with this (you sound like you're at a similiar stage to me). i've booked in for my exam on wednesday morning so i'm gonna be working day and night for the next few days - looking forward to nailing this and getting outisde at weekends. planning to go off to australia at the end of summer.
good point - i think there is potentially loads of work that could be done fixing up Data. I noticed getRecordCount returns the total number of records including the deleted ones.
i was advised to leave this side of things alone, and just assume (becasue there is no mention of it in the requirements) that there will not be any deleted records in the fly by night system. what do you reacon ?
really with regard to fixing the exception's in Data, I was just going to modify the constructor, lock and unlock signatures so they throw DatabaseException.
it seems (from what i've read from others) as long as you can defend your decision to do something you are ok .
Steven
I highly highly recommend NOT REMOVING anything that SUN gave you in your code, except for the deprecated methods. They have very good reasons for the exceptions that they throw. Each and everyone of them makes complete sense.
/**
* Ensures that the database structure is valid.
* @exception RuntimeException If structure has become corrupted.
*/
protected final synchronized void invariant() {
boolean ok = false;
try {
if (db.length() == headerLen + (recordLen * recordCount)) {
ok = true;
}
} catch (Exception e) {
throw new RuntimeException(UNEXPECTED + e);
}
if (!ok) {
throw new RuntimeException("Data: Internal error");
Consider Paul's rocket mass heater. |