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