Code improvements.
This commit is contained in:
@ -191,10 +191,7 @@ public class SQLAccountManager
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE accounts(login, password, accessLevel) VALUES (?, ?, ?)"))
|
||||
{
|
||||
final MessageDigest md = MessageDigest.getInstance("SHA");
|
||||
byte[] newPassword;
|
||||
newPassword = password.getBytes("UTF-8");
|
||||
newPassword = md.digest(newPassword);
|
||||
|
||||
final byte[] newPassword = md.digest(password.getBytes("UTF-8"));
|
||||
ps.setString(1, account);
|
||||
ps.setString(2, Base64.getEncoder().encodeToString(newPassword));
|
||||
ps.setString(3, level);
|
||||
|
@ -115,11 +115,7 @@ public class CloseShieldedInputStream extends InputStream
|
||||
@Override
|
||||
public boolean markSupported()
|
||||
{
|
||||
if (_in == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _in.markSupported();
|
||||
return (_in != null) && _in.markSupported();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,16 +50,17 @@ public class ScriptExecutor
|
||||
public void execSqlBatch(File dir, boolean skipErrors)
|
||||
{
|
||||
final File[] files = dir.listFiles(new SQLFilter());
|
||||
if (files != null)
|
||||
if (files == null)
|
||||
{
|
||||
Arrays.sort(files);
|
||||
_frame.setProgressIndeterminate(false);
|
||||
_frame.setProgressMaximum(files.length - 1);
|
||||
for (int i = 0; i < files.length; i++)
|
||||
{
|
||||
_frame.setProgressValue(i);
|
||||
execSqlFile(files[i], skipErrors);
|
||||
}
|
||||
return;
|
||||
}
|
||||
Arrays.sort(files);
|
||||
_frame.setProgressIndeterminate(false);
|
||||
_frame.setProgressMaximum(files.length - 1);
|
||||
for (int i = 0; i < files.length; i++)
|
||||
{
|
||||
_frame.setProgressValue(i);
|
||||
execSqlFile(files[i], skipErrors);
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,8 +119,7 @@ public class ScriptExecutor
|
||||
"Abort"
|
||||
};
|
||||
|
||||
final int n = JOptionPane.showOptionDialog(null, "MySQL Error: " + e.getMessage(), "Script Error", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
||||
if (n == 1)
|
||||
if (JOptionPane.showOptionDialog(null, "MySQL Error: " + e.getMessage(), "Script Error", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]) == 1)
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
|
@ -153,9 +153,7 @@ public class SpringUtilities
|
||||
/* Used by makeCompactGrid. */
|
||||
private static SpringLayout.Constraints getConstraintsForCell(int row, int col, Container parent, int cols)
|
||||
{
|
||||
final SpringLayout layout = (SpringLayout) parent.getLayout();
|
||||
final Component c = parent.getComponent((row * cols) + col);
|
||||
return layout.getConstraints(c);
|
||||
return ((SpringLayout) parent.getLayout()).getConstraints(parent.getComponent((row * cols) + col));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,8 +40,7 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
super();
|
||||
load();
|
||||
|
||||
final int size = GameServerTable.getInstance().getServerNames().size();
|
||||
if (size == 0)
|
||||
if (GameServerTable.getInstance().getServerNames().size() == 0)
|
||||
{
|
||||
System.out.println("No available names for GameServer, verify servername.xml file exists in the LoginServer folder.");
|
||||
System.exit(1);
|
||||
@ -301,8 +300,7 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
}
|
||||
while (id == Integer.MIN_VALUE);
|
||||
|
||||
final String name = GameServerTable.getInstance().getServerNameById(id);
|
||||
if (name == null)
|
||||
if (GameServerTable.getInstance().getServerNameById(id) == null)
|
||||
{
|
||||
System.out.printf("No name for ID: %d" + Config.EOL, id);
|
||||
}
|
||||
@ -329,9 +327,7 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
@Override
|
||||
public void showError(String msg, Throwable t)
|
||||
{
|
||||
String title;
|
||||
title = "Error";
|
||||
msg += Config.EOL + "Reason: " + t.getLocalizedMessage();
|
||||
System.out.println(title + ": " + msg);
|
||||
System.out.println("Error: " + msg);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user