Catch potential IOExceptions

This commit is contained in:
Reinhard Pointner 2016-11-12 04:46:14 +08:00
parent 434f2e59d9
commit 05f2a0be85
1 changed files with 11 additions and 5 deletions

View File

@ -144,13 +144,19 @@ public class GroovyPad extends JFrame {
return new RTextScrollPane(output, true);
}
protected FileLocation getFileLocation(String name) throws IOException {
File pad = ApplicationFolder.AppData.resolve(name);
if (!pad.exists()) {
protected FileLocation getFileLocation(String name) {
try {
// use this default value so people can easily submit bug reports with fn:sysinfo logs
ScriptShellMethods.saveAs(DEFAULT_SCRIPT, pad);
File pad = ApplicationFolder.AppData.resolve(name);
if (!pad.exists()) {
ScriptShellMethods.saveAs(DEFAULT_SCRIPT, pad);
return FileLocation.create(pad);
}
} catch (Exception e) {
debug.log(Level.WARNING, e, e::toString);
}
return FileLocation.create(pad);
return null;
}
protected final ScriptShell shell;