Statement s = conn.createStatement();
//
ResultSet rs = s.executeQuery("SELECT content FROM JoramDB WHERE name='" + fname + "'");
if (!rs.next()) {
throw new FileNotFoundException("Cannot find object in JoramDB " + ("serverCounter".equals(fname)?"[KNOWN PROBLEM] ":"") + fname);
}
byte[] content = rs.getBytes(1);
rs.close();
s.close();
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "load, after database call");
nbloaded += 1;
return content;
} catch (SQLException sqle) {
if (sqle instanceof com.mysql.jdbc.CommunicationsException && !reconnectLoop)
{
logger.log(BasicLevel.WARN, "Database reconnection problem at load, Reconnecting");
reconnection();
reconnectLoop = true;
byte[] content = load(dirName, name);
reconnectLoop = false;
return content;
}
if (reconnectLoop)
logger.log(BasicLevel.WARN, "Database reconnection problem at load");
logger.log(BasicLevel.WARN, "load, problem load " + name);
sqle.printStackTrace();
throw new IOException(sqle.getMessage());
} catch (Exception e) {
String exceptionString = e.toString();
if (exceptionString.indexOf("KNOWN PROBLEM") == -1)
{
logger.log(BasicLevel.WARN, "load, problem load " + name + " in e with " + e.getMessage());
e.printStackTrace();
}
throw new FileNotFoundException(e.getMessage());
}
}