This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hello all, I have a question about choosing database location. Suppose when starting the server mode or local mode, the user enters a file that isn't the correct file (such as wrong magic cookie value, or simply blank file). Now my current approach is once they enter this value, I save it in a Properties and store into the properties file then load the main window. If wrong file, it pops up an error saying can't find or read file and exit.
Now since the file path already stored in the properties file, subsequent runs will always pop up error. Will this cause me automatically failure?? Since the properties file is generated on the fly and Sun examiners are supposed NOT to change any files. Is the properties file part of this "NOT change" business?
Each time the application is started in either Server or Standalone mode, can the user change the location of database file?
One option is that you save the file location to the properties file only if the file is correct ie the file exists on disk and magic cookie is correct. This way, user would always see the last correct file
This was my approach: before anything, I get the database path the user provided, and verify if it exists (new File(dbLocation).exists()). If so, then I proceed and save this path in the .properties file, if not, I show a JOptionPane.showMessageDialog, saying that the path is invalid.