Try to fix an issue with sqlite, should fix #78

Not tested, so can't really tell if it fixes it or not.
This commit is contained in:
graywolf336 2015-05-30 13:55:21 -05:00
parent d3d4572ca4
commit 73715c3d68

View File

@ -180,14 +180,24 @@ public class JailIO {
private Connection getConnection() { private Connection getConnection() {
switch(storage) { switch(storage) {
case 1: case 1:
case 2:
if(con == null) this.prepareStorage(false); if(con == null) this.prepareStorage(false);
try { try {
if(!con.isValid(10)) this.prepareStorage(false); if(con.isClosed()) this.prepareStorage(false);
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
pl.getLogger().severe("---------- Jail Error!!! ----------"); pl.getLogger().severe("---------- Jail Error!!! ----------");
pl.getLogger().severe("Unable to get a Sql connection, please see the error above and fix the problem."); pl.getLogger().severe("Unable to get a SQLite connection, please see the error above and fix the problem.");
return null;
}
return con;
case 2:
if(con == null) this.prepareStorage(false);
try {
if(con.isClosed() || !con.isValid(10)) this.prepareStorage(false);
} catch (SQLException e) {
e.printStackTrace();
pl.getLogger().severe("---------- Jail Error!!! ----------");
pl.getLogger().severe("Unable to get a MySql connection, please see the error above and fix the problem.");
return null; return null;
} }
return con; return con;