• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Missing property/db files - failfast or tolerate?

 
Jason Then
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok so, this is like a continuation of my last post, as after a bit of User testing of my application, turns out I ran into a few minor issues.

I'm trying to decide what the best implementation might be with regards to what the program should do if the suncertify.properties and database files do/don't exist.

At the moment, if suncertify.properties isn't there, the application just uses default values. The client/standalone modes persist properties when the Options Dialog is successfully closed.

If the database file isn't there, the server won't start - it outputs an error message. Alternatively, an empty database could be started - but this seems like it could mislead the User...
In standalone mode, the application is started in an "Invalid state" - until the User specifies the correct file in the Options Dialog.
Obviously in client mode, the application doesn't use the db file, but if it can't connect to the server then the application is equally started in the invalid state.

What do your applications do in the event of a missing properties/db file??
Is this sensible behaviour for my application? I am just worried about the markers trying to start the server, failing to do so because there's no db file, and then failing my assignment
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I have:

I have the same policy like you if it comes to the property file. It is persisted after the input settings are checked and window closes. If the file does not exist it is created (empty) during loadProperties() stage.

If the database file path is not set in the settings window - the alert is raised (warning level) and user have to insert it.
If he chooses the invalid path (it is checked by using isFile(), canRead(), canWrite() - if any of those fails the path is treated as invalid) the alert is also raised (warning level) and user have to insert valid path.

If the user chooses the writable, readable, valid file, the magic cookie value and overall structure (record lengths, etc.) are checked in the database layer and if this validation fails, the alert (error level) is raised and the application quits.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My approach (as simple as possible, like always)
- When no properties file exists, one is created with default values
- When the user specified a wrong value (invalid database file, wrong ip, wrong port,...), an appropriate message is shown and the application (client or server) ends
- When the user specified correct values, these values are stored in the properties file
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic