se-edu / addressbook-level3

:ab::three: Address Book sample application (Level 3)
https://se-education.org/addressbook-level3
MIT License
28 stars 415 forks source link

[#73] no write access fail gracefully #165

Closed Eclipse-Dominator closed 1 year ago

Eclipse-Dominator commented 1 year ago

Fixes #73 Continued from #77

Renames warning message to remind user to exit the application immediately.

canihasreview[bot] commented 1 year ago

Click here to submit a new iteration when this PR is ready for review.

See this repository's contribution guide for more information.

Eclipse-Dominator commented 1 year ago

There is an issue with the exit command where exit will attempt to save all file before exiting and due to the permission error, it will prevent the program from exiting.

I came up with the following solutions regarding the above

  1. Immediately exit regardless of save errors
  2. Adds a 3s timer to show the fail to exit before exiting (only on exit command)
  3. Change warning message to tell the user to close via clicking on the x button [current approach]

I am not sure which solution is the right approach.


A separate issue is when the preference folder is not writeable. Error messages like so can still be seen image The IO exception is still caught here

        //Update config file in case it was missing to begin with or there are new/unused fields
        try {
            ConfigUtil.saveConfig(initializedConfig, configFilePathUsed);
        } catch (IOException e) {
            logger.warning("Failed to save config file : " + StringUtil.getDetails(e));
        }
        return initializedConfig;

So I am not sure if we should change this message.

Eclipse-Dominator commented 1 year ago

Refer to #172