V
VisionSet
I set up my model with one call from the view: getModel()
This instantiates the model if one is not present, singleton fashion.
The instantiation retrieves various files and processes a lot of try catch
IOExceptions. One case is the single call to create a Properties object,
which I have wrapped.
properties = new MyProperties();
This looks for an exisiting file, validates it and creates a whole new file
or just ammends single properties for any failed validations.
I need to pass any problems back to the view to notify the user, even if
they have been handled nicely.
If my new MyProperties() throws an exception, I won't have an object.
An alternative is to set a 'problems' attribute in MyProperties and query it
after instantiation.
Then throw a new exception from Model() constructor.
Or is exceptions not the way to go at all, and I should catch everything as
I am doing and build a log StringBuffer or something to pass to the user?
The exceptions that are thrown I consider truely exceptional, all will be
fine if the admin user sets up a bad file after the 1st run, since
MyProperties corrects the situation.
What is the best way to approach this requirement?
This instantiates the model if one is not present, singleton fashion.
The instantiation retrieves various files and processes a lot of try catch
IOExceptions. One case is the single call to create a Properties object,
which I have wrapped.
properties = new MyProperties();
This looks for an exisiting file, validates it and creates a whole new file
or just ammends single properties for any failed validations.
I need to pass any problems back to the view to notify the user, even if
they have been handled nicely.
If my new MyProperties() throws an exception, I won't have an object.
An alternative is to set a 'problems' attribute in MyProperties and query it
after instantiation.
Then throw a new exception from Model() constructor.
Or is exceptions not the way to go at all, and I should catch everything as
I am doing and build a log StringBuffer or something to pass to the user?
The exceptions that are thrown I consider truely exceptional, all will be
fine if the admin user sets up a bad file after the 1st run, since
MyProperties corrects the situation.
What is the best way to approach this requirement?