Kyle-Falconer / Court-Scheduler

3 stars 2 forks source link

Crash when writing out to .xlsx #5

Closed Kyle-Falconer closed 10 years ago

Kyle-Falconer commented 10 years ago

The program will crash when trying to write out to the .xlsx file if the file is already open in Excel or any other program with the following log entry:

java.io.FileNotFoundException: output.xlsx (The process cannot access the file because it is being used by another process)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:165)
at courtscheduler.domain.CourtSchedule.writeXlsx(CourtSchedule.java:319)
at courtscheduler.Main.main(Main.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

The program should catch this sort of error, prompt the user, and then re-try until either successful or cancelled by the end user.

pkmccroskey commented 10 years ago

1177430 Ready to be tested.

Kyle-Falconer commented 10 years ago

Looks good. Closing this.