Фикс инициализации MySQLAuthHandler

This commit is contained in:
Gravit 2018-12-26 18:35:28 +07:00
parent 84a6784d26
commit 05bad22ede
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 31 additions and 5 deletions

View file

@ -118,6 +118,18 @@ public String getBindAddress() {
return bindAddress;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setBinaryName(String binaryName) {
this.binaryName = binaryName;
}
public void setEnv(LauncherConfig.LauncherEnvironment env) {
this.env = env;
}
public SocketAddress getSocketAddress() {
return new InetSocketAddress(bindAddress, port);
@ -478,6 +490,8 @@ private void generateConfigIfNotExists() throws IOException {
// Set server address
LogHelper.println("LaunchServer address: ");
newConfig.setAddress(commandHandler.readLine());
LogHelper.println("LaunchServer projectName: ");
newConfig.setProjectName(commandHandler.readLine());
// Write LaunchServer config
LogHelper.info("Writing LaunchServer config file");

View file

@ -15,13 +15,25 @@ public final class MySQLAuthHandler extends CachedAuthHandler {
private String usernameColumn;
private String accessTokenColumn;
private String serverIDColumn;
private String table;
// Prepared SQL queries
private String queryByUUIDSQL;
private String queryByUsernameSQL;
private String updateAuthSQL;
private String updateServerIDSQL;
private transient String queryByUUIDSQL;
private transient String queryByUsernameSQL;
private transient String updateAuthSQL;
private transient String updateServerIDSQL;
public MySQLAuthHandler()
{
// Prepare SQL queries
queryByUUIDSQL = String.format("SELECT %s, %s, %s, %s FROM %s WHERE %s=? LIMIT 1",
uuidColumn, usernameColumn, accessTokenColumn, serverIDColumn, table, uuidColumn);
queryByUsernameSQL = String.format("SELECT %s, %s, %s, %s FROM %s WHERE %s=? LIMIT 1",
uuidColumn, usernameColumn, accessTokenColumn, serverIDColumn, table, usernameColumn);
updateAuthSQL = String.format("UPDATE %s SET %s=?, %s=?, %s=NULL WHERE %s=? LIMIT 1",
table, usernameColumn, accessTokenColumn, serverIDColumn, uuidColumn);
updateServerIDSQL = String.format("UPDATE %s SET %s=? WHERE %s=? LIMIT 1",
table, serverIDColumn, uuidColumn);
}
@Override
public void close() {
mySQLHolder.close();