Changes based on Java 10 recommendations.
This commit is contained in:
@ -715,7 +715,7 @@ public class MasterHandler
|
||||
|
||||
try
|
||||
{
|
||||
final Object handler = c.newInstance();
|
||||
final Object handler = c.getDeclaredConstructor().newInstance();
|
||||
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
|
||||
{
|
||||
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))
|
||||
|
@ -897,7 +897,7 @@ public class QuestMasterHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
quest.newInstance();
|
||||
quest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
2
L2J_Mobius_1.0_Ertheia/dist/game/java.cfg
vendored
2
L2J_Mobius_1.0_Ertheia/dist/game/java.cfg
vendored
@ -1 +1 @@
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
@ -311,8 +311,8 @@ public class Gui
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
JLayeredPane layeredPanel = new JLayeredPane();
|
||||
layeredPanel.add(scrollPanel, new Integer(0), 0);
|
||||
layeredPanel.add(systemPanel, new Integer(1), 0);
|
||||
layeredPanel.add(scrollPanel, 0, 0);
|
||||
layeredPanel.add(systemPanel, 1, 0);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - GameServer");
|
||||
|
@ -370,7 +370,7 @@ public class SchedulingPattern
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
for (int i = min; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
@ -393,7 +393,7 @@ public class SchedulingPattern
|
||||
if (size == 1)
|
||||
{
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
return values;
|
||||
}
|
||||
String v2Str = st.nextToken();
|
||||
@ -411,7 +411,7 @@ public class SchedulingPattern
|
||||
{
|
||||
for (int i = v1; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else if (v1 > v2)
|
||||
@ -420,17 +420,17 @@ public class SchedulingPattern
|
||||
int max = parser.getMaxValue();
|
||||
for (int i = v1; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
for (int i = min; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// v1 == v2
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherGS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/game/";
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherLS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/login/";
|
||||
|
@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
{
|
||||
Connection _con;
|
||||
|
||||
public DBInstallerConsole(String db, String dir)
|
||||
public DBInstallerConsole(String db, String dir) throws Exception
|
||||
{
|
||||
System.out.println("Welcome to L2J DataBase installer");
|
||||
final Preferences prop = Preferences.userRoot();
|
||||
@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
* @param pass the password
|
||||
* @param database the database name
|
||||
* @param mode the mode, c: Clean, u:update
|
||||
* @throws Exception
|
||||
*/
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode)
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
|
||||
{
|
||||
if ((database == null) || database.isEmpty())
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.commons.util.SplashScreen;
|
||||
import com.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
|
||||
final int height = 220;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
|
||||
|
||||
final ActionListener connectListener = e ->
|
||||
{
|
||||
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
MySqlConnect connector = null;
|
||||
try
|
||||
{
|
||||
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if (connector.getConnection() != null)
|
||||
if ((connector != null) && (connector.getConnection() != null))
|
||||
{
|
||||
_prop.put("dbHost_" + _db, _dbHost.getText());
|
||||
_prop.put("dbPort_" + _db, _dbPort.getText());
|
||||
|
@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
|
||||
|
||||
@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
final int height = 360;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class MySqlConnect
|
||||
{
|
||||
Connection con = null;
|
||||
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
|
||||
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
|
||||
con = DriverManager.getConnection(formattedText, user, password);
|
||||
|
||||
|
@ -717,7 +717,7 @@ public class MasterHandler
|
||||
|
||||
try
|
||||
{
|
||||
final Object handler = c.newInstance();
|
||||
final Object handler = c.getDeclaredConstructor().newInstance();
|
||||
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
|
||||
{
|
||||
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))
|
||||
|
@ -963,7 +963,7 @@ public class QuestMasterHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
quest.newInstance();
|
||||
quest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
@ -49,7 +49,6 @@ public class DailyMissionHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -311,8 +311,8 @@ public class Gui
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
JLayeredPane layeredPanel = new JLayeredPane();
|
||||
layeredPanel.add(scrollPanel, new Integer(0), 0);
|
||||
layeredPanel.add(systemPanel, new Integer(1), 0);
|
||||
layeredPanel.add(scrollPanel, 0, 0);
|
||||
layeredPanel.add(systemPanel, 1, 0);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - GameServer");
|
||||
|
@ -370,7 +370,7 @@ public class SchedulingPattern
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
for (int i = min; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
@ -393,7 +393,7 @@ public class SchedulingPattern
|
||||
if (size == 1)
|
||||
{
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
return values;
|
||||
}
|
||||
String v2Str = st.nextToken();
|
||||
@ -411,7 +411,7 @@ public class SchedulingPattern
|
||||
{
|
||||
for (int i = v1; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else if (v1 > v2)
|
||||
@ -420,17 +420,17 @@ public class SchedulingPattern
|
||||
int max = parser.getMaxValue();
|
||||
for (int i = v1; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
for (int i = min; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// v1 == v2
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherGS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/game/";
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherLS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/login/";
|
||||
|
@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
{
|
||||
Connection _con;
|
||||
|
||||
public DBInstallerConsole(String db, String dir)
|
||||
public DBInstallerConsole(String db, String dir) throws Exception
|
||||
{
|
||||
System.out.println("Welcome to L2J DataBase installer");
|
||||
final Preferences prop = Preferences.userRoot();
|
||||
@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
* @param pass the password
|
||||
* @param database the database name
|
||||
* @param mode the mode, c: Clean, u:update
|
||||
* @throws Exception
|
||||
*/
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode)
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
|
||||
{
|
||||
if ((database == null) || database.isEmpty())
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.commons.util.SplashScreen;
|
||||
import com.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
|
||||
final int height = 220;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
|
||||
|
||||
final ActionListener connectListener = e ->
|
||||
{
|
||||
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
MySqlConnect connector = null;
|
||||
try
|
||||
{
|
||||
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if (connector.getConnection() != null)
|
||||
if ((connector != null) && (connector.getConnection() != null))
|
||||
{
|
||||
_prop.put("dbHost_" + _db, _dbHost.getText());
|
||||
_prop.put("dbPort_" + _db, _dbPort.getText());
|
||||
|
@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
|
||||
|
||||
@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
final int height = 360;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class MySqlConnect
|
||||
{
|
||||
Connection con = null;
|
||||
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
|
||||
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
|
||||
con = DriverManager.getConnection(formattedText, user, password);
|
||||
|
||||
|
@ -719,7 +719,7 @@ public class MasterHandler
|
||||
|
||||
try
|
||||
{
|
||||
final Object handler = c.newInstance();
|
||||
final Object handler = c.getDeclaredConstructor().newInstance();
|
||||
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
|
||||
{
|
||||
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))
|
||||
|
@ -893,7 +893,7 @@ public class QuestMasterHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
quest.newInstance();
|
||||
quest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
2
L2J_Mobius_3.0_Helios/dist/game/java.cfg
vendored
2
L2J_Mobius_3.0_Helios/dist/game/java.cfg
vendored
@ -1 +1 @@
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
@ -49,7 +49,6 @@ public class DailyMissionHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -311,8 +311,8 @@ public class Gui
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
JLayeredPane layeredPanel = new JLayeredPane();
|
||||
layeredPanel.add(scrollPanel, new Integer(0), 0);
|
||||
layeredPanel.add(systemPanel, new Integer(1), 0);
|
||||
layeredPanel.add(scrollPanel, 0, 0);
|
||||
layeredPanel.add(systemPanel, 1, 0);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - GameServer");
|
||||
|
@ -370,7 +370,7 @@ public class SchedulingPattern
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
for (int i = min; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
@ -393,7 +393,7 @@ public class SchedulingPattern
|
||||
if (size == 1)
|
||||
{
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
return values;
|
||||
}
|
||||
String v2Str = st.nextToken();
|
||||
@ -411,7 +411,7 @@ public class SchedulingPattern
|
||||
{
|
||||
for (int i = v1; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else if (v1 > v2)
|
||||
@ -420,17 +420,17 @@ public class SchedulingPattern
|
||||
int max = parser.getMaxValue();
|
||||
for (int i = v1; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
for (int i = min; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// v1 == v2
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherGS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/game/";
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherLS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/login/";
|
||||
|
@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
{
|
||||
Connection _con;
|
||||
|
||||
public DBInstallerConsole(String db, String dir)
|
||||
public DBInstallerConsole(String db, String dir) throws Exception
|
||||
{
|
||||
System.out.println("Welcome to L2J DataBase installer");
|
||||
final Preferences prop = Preferences.userRoot();
|
||||
@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
* @param pass the password
|
||||
* @param database the database name
|
||||
* @param mode the mode, c: Clean, u:update
|
||||
* @throws Exception
|
||||
*/
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode)
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
|
||||
{
|
||||
if ((database == null) || database.isEmpty())
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.commons.util.SplashScreen;
|
||||
import com.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
|
||||
final int height = 220;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
|
||||
|
||||
final ActionListener connectListener = e ->
|
||||
{
|
||||
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
MySqlConnect connector = null;
|
||||
try
|
||||
{
|
||||
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if (connector.getConnection() != null)
|
||||
if ((connector != null) && (connector.getConnection() != null))
|
||||
{
|
||||
_prop.put("dbHost_" + _db, _dbHost.getText());
|
||||
_prop.put("dbPort_" + _db, _dbPort.getText());
|
||||
|
@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
|
||||
|
||||
@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
final int height = 360;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class MySqlConnect
|
||||
{
|
||||
Connection con = null;
|
||||
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
|
||||
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
|
||||
con = DriverManager.getConnection(formattedText, user, password);
|
||||
|
||||
|
@ -719,7 +719,7 @@ public class MasterHandler
|
||||
|
||||
try
|
||||
{
|
||||
final Object handler = c.newInstance();
|
||||
final Object handler = c.getDeclaredConstructor().newInstance();
|
||||
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
|
||||
{
|
||||
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))
|
||||
|
@ -887,7 +887,7 @@ public class QuestMasterHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
quest.newInstance();
|
||||
quest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
@ -49,7 +49,6 @@ public class DailyMissionHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -311,8 +311,8 @@ public class Gui
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
JLayeredPane layeredPanel = new JLayeredPane();
|
||||
layeredPanel.add(scrollPanel, new Integer(0), 0);
|
||||
layeredPanel.add(systemPanel, new Integer(1), 0);
|
||||
layeredPanel.add(scrollPanel, 0, 0);
|
||||
layeredPanel.add(systemPanel, 1, 0);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - GameServer");
|
||||
|
@ -370,7 +370,7 @@ public class SchedulingPattern
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
for (int i = min; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
@ -393,7 +393,7 @@ public class SchedulingPattern
|
||||
if (size == 1)
|
||||
{
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
return values;
|
||||
}
|
||||
String v2Str = st.nextToken();
|
||||
@ -411,7 +411,7 @@ public class SchedulingPattern
|
||||
{
|
||||
for (int i = v1; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else if (v1 > v2)
|
||||
@ -420,17 +420,17 @@ public class SchedulingPattern
|
||||
int max = parser.getMaxValue();
|
||||
for (int i = v1; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
for (int i = min; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// v1 == v2
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherGS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/game/";
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherLS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/login/";
|
||||
|
@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
{
|
||||
Connection _con;
|
||||
|
||||
public DBInstallerConsole(String db, String dir)
|
||||
public DBInstallerConsole(String db, String dir) throws Exception
|
||||
{
|
||||
System.out.println("Welcome to L2J DataBase installer");
|
||||
final Preferences prop = Preferences.userRoot();
|
||||
@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
* @param pass the password
|
||||
* @param database the database name
|
||||
* @param mode the mode, c: Clean, u:update
|
||||
* @throws Exception
|
||||
*/
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode)
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
|
||||
{
|
||||
if ((database == null) || database.isEmpty())
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.commons.util.SplashScreen;
|
||||
import com.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
|
||||
final int height = 220;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
|
||||
|
||||
final ActionListener connectListener = e ->
|
||||
{
|
||||
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
MySqlConnect connector = null;
|
||||
try
|
||||
{
|
||||
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if (connector.getConnection() != null)
|
||||
if ((connector != null) && (connector.getConnection() != null))
|
||||
{
|
||||
_prop.put("dbHost_" + _db, _dbHost.getText());
|
||||
_prop.put("dbPort_" + _db, _dbPort.getText());
|
||||
|
@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
|
||||
|
||||
@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
final int height = 360;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class MySqlConnect
|
||||
{
|
||||
Connection con = null;
|
||||
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
|
||||
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
|
||||
con = DriverManager.getConnection(formattedText, user, password);
|
||||
|
||||
|
@ -15,6 +15,14 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonN
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
@ -114,6 +122,8 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
|
||||
|
@ -641,7 +641,7 @@ public class MasterHandler
|
||||
|
||||
try
|
||||
{
|
||||
final Object handler = c.newInstance();
|
||||
final Object handler = c.getDeclaredConstructor().newInstance();
|
||||
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
|
||||
{
|
||||
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))
|
||||
|
@ -1049,7 +1049,7 @@ public class QuestMasterHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
quest.newInstance();
|
||||
quest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
@ -311,8 +311,8 @@ public class Gui
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
JLayeredPane layeredPanel = new JLayeredPane();
|
||||
layeredPanel.add(scrollPanel, new Integer(0), 0);
|
||||
layeredPanel.add(systemPanel, new Integer(1), 0);
|
||||
layeredPanel.add(scrollPanel, 0, 0);
|
||||
layeredPanel.add(systemPanel, 1, 0);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - GameServer");
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherGS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobiush5";
|
||||
final String dir = "sql/game/";
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherLS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobiush5";
|
||||
final String dir = "sql/login/";
|
||||
|
@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
{
|
||||
Connection _con;
|
||||
|
||||
public DBInstallerConsole(String db, String dir)
|
||||
public DBInstallerConsole(String db, String dir) throws Exception
|
||||
{
|
||||
System.out.println("Welcome to L2J DataBase installer");
|
||||
final Preferences prop = Preferences.userRoot();
|
||||
@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
* @param pass the password
|
||||
* @param database the database name
|
||||
* @param mode the mode, c: Clean, u:update
|
||||
* @throws Exception
|
||||
*/
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode)
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
|
||||
{
|
||||
if ((database == null) || database.isEmpty())
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.commons.util.SplashScreen;
|
||||
import com.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
|
||||
final int height = 220;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
|
||||
|
||||
final ActionListener connectListener = e ->
|
||||
{
|
||||
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
MySqlConnect connector = null;
|
||||
try
|
||||
{
|
||||
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if (connector.getConnection() != null)
|
||||
if ((connector != null) && (connector.getConnection() != null))
|
||||
{
|
||||
_prop.put("dbHost_" + _db, _dbHost.getText());
|
||||
_prop.put("dbPort_" + _db, _dbPort.getText());
|
||||
|
@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
|
||||
|
||||
@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
final int height = 360;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class MySqlConnect
|
||||
{
|
||||
Connection con = null;
|
||||
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
|
||||
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
|
||||
con = DriverManager.getConnection(formattedText, user, password);
|
||||
|
||||
|
@ -719,7 +719,7 @@ public class MasterHandler
|
||||
|
||||
try
|
||||
{
|
||||
final Object handler = c.newInstance();
|
||||
final Object handler = c.getDeclaredConstructor().newInstance();
|
||||
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
|
||||
{
|
||||
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))
|
||||
|
@ -363,7 +363,7 @@ public class QuestMasterHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
quest.newInstance();
|
||||
quest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
@ -49,7 +49,6 @@ public class DailyMissionHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -299,8 +299,8 @@ public class Gui
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
JLayeredPane layeredPanel = new JLayeredPane();
|
||||
layeredPanel.add(scrollPanel, new Integer(0), 0);
|
||||
layeredPanel.add(systemPanel, new Integer(1), 0);
|
||||
layeredPanel.add(scrollPanel, 0, 0);
|
||||
layeredPanel.add(systemPanel, 1, 0);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - GameServer");
|
||||
|
@ -370,7 +370,7 @@ public class SchedulingPattern
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
for (int i = min; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
@ -393,7 +393,7 @@ public class SchedulingPattern
|
||||
if (size == 1)
|
||||
{
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
return values;
|
||||
}
|
||||
String v2Str = st.nextToken();
|
||||
@ -411,7 +411,7 @@ public class SchedulingPattern
|
||||
{
|
||||
for (int i = v1; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else if (v1 > v2)
|
||||
@ -420,17 +420,17 @@ public class SchedulingPattern
|
||||
int max = parser.getMaxValue();
|
||||
for (int i = v1; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
for (int i = min; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// v1 == v2
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherGS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/game/";
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherLS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/login/";
|
||||
|
@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
{
|
||||
Connection _con;
|
||||
|
||||
public DBInstallerConsole(String db, String dir)
|
||||
public DBInstallerConsole(String db, String dir) throws Exception
|
||||
{
|
||||
System.out.println("Welcome to L2J DataBase installer");
|
||||
final Preferences prop = Preferences.userRoot();
|
||||
@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
* @param pass the password
|
||||
* @param database the database name
|
||||
* @param mode the mode, c: Clean, u:update
|
||||
* @throws Exception
|
||||
*/
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode)
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
|
||||
{
|
||||
if ((database == null) || database.isEmpty())
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.commons.util.SplashScreen;
|
||||
import com.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
|
||||
final int height = 220;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
|
||||
|
||||
final ActionListener connectListener = e ->
|
||||
{
|
||||
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
MySqlConnect connector = null;
|
||||
try
|
||||
{
|
||||
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if (connector.getConnection() != null)
|
||||
if ((connector != null) && (connector.getConnection() != null))
|
||||
{
|
||||
_prop.put("dbHost_" + _db, _dbHost.getText());
|
||||
_prop.put("dbPort_" + _db, _dbPort.getText());
|
||||
|
@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
|
||||
|
||||
@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
final int height = 360;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class MySqlConnect
|
||||
{
|
||||
Connection con = null;
|
||||
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
|
||||
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
|
||||
con = DriverManager.getConnection(formattedText, user, password);
|
||||
|
||||
|
@ -719,7 +719,7 @@ public class MasterHandler
|
||||
|
||||
try
|
||||
{
|
||||
final Object handler = c.newInstance();
|
||||
final Object handler = c.getDeclaredConstructor().newInstance();
|
||||
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
|
||||
{
|
||||
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))
|
||||
|
@ -357,7 +357,7 @@ public class QuestMasterHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
quest.newInstance();
|
||||
quest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
@ -49,7 +49,6 @@ public class DailyMissionHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -299,8 +299,8 @@ public class Gui
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
JLayeredPane layeredPanel = new JLayeredPane();
|
||||
layeredPanel.add(scrollPanel, new Integer(0), 0);
|
||||
layeredPanel.add(systemPanel, new Integer(1), 0);
|
||||
layeredPanel.add(scrollPanel, 0, 0);
|
||||
layeredPanel.add(systemPanel, 1, 0);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - GameServer");
|
||||
|
@ -370,7 +370,7 @@ public class SchedulingPattern
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
for (int i = min; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
@ -393,7 +393,7 @@ public class SchedulingPattern
|
||||
if (size == 1)
|
||||
{
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
return values;
|
||||
}
|
||||
String v2Str = st.nextToken();
|
||||
@ -411,7 +411,7 @@ public class SchedulingPattern
|
||||
{
|
||||
for (int i = v1; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else if (v1 > v2)
|
||||
@ -420,17 +420,17 @@ public class SchedulingPattern
|
||||
int max = parser.getMaxValue();
|
||||
for (int i = v1; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
for (int i = min; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// v1 == v2
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherGS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/game/";
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherLS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/login/";
|
||||
|
@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
{
|
||||
Connection _con;
|
||||
|
||||
public DBInstallerConsole(String db, String dir)
|
||||
public DBInstallerConsole(String db, String dir) throws Exception
|
||||
{
|
||||
System.out.println("Welcome to L2J DataBase installer");
|
||||
final Preferences prop = Preferences.userRoot();
|
||||
@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
* @param pass the password
|
||||
* @param database the database name
|
||||
* @param mode the mode, c: Clean, u:update
|
||||
* @throws Exception
|
||||
*/
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode)
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
|
||||
{
|
||||
if ((database == null) || database.isEmpty())
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.commons.util.SplashScreen;
|
||||
import com.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
|
||||
final int height = 220;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
|
||||
|
||||
final ActionListener connectListener = e ->
|
||||
{
|
||||
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
MySqlConnect connector = null;
|
||||
try
|
||||
{
|
||||
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if (connector.getConnection() != null)
|
||||
if ((connector != null) && (connector.getConnection() != null))
|
||||
{
|
||||
_prop.put("dbHost_" + _db, _dbHost.getText());
|
||||
_prop.put("dbPort_" + _db, _dbPort.getText());
|
||||
|
@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
|
||||
|
||||
@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
final int height = 360;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class MySqlConnect
|
||||
{
|
||||
Connection con = null;
|
||||
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
|
||||
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
|
||||
con = DriverManager.getConnection(formattedText, user, password);
|
||||
|
||||
|
@ -719,7 +719,7 @@ public class MasterHandler
|
||||
|
||||
try
|
||||
{
|
||||
final Object handler = c.newInstance();
|
||||
final Object handler = c.getDeclaredConstructor().newInstance();
|
||||
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
|
||||
{
|
||||
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))
|
||||
|
@ -357,7 +357,7 @@ public class QuestMasterHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
quest.newInstance();
|
||||
quest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
||||
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
|
@ -49,7 +49,6 @@ public class DailyMissionHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -299,8 +299,8 @@ public class Gui
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
JLayeredPane layeredPanel = new JLayeredPane();
|
||||
layeredPanel.add(scrollPanel, new Integer(0), 0);
|
||||
layeredPanel.add(systemPanel, new Integer(1), 0);
|
||||
layeredPanel.add(scrollPanel, 0, 0);
|
||||
layeredPanel.add(systemPanel, 1, 0);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - GameServer");
|
||||
|
@ -370,7 +370,7 @@ public class SchedulingPattern
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
for (int i = min; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
@ -393,7 +393,7 @@ public class SchedulingPattern
|
||||
if (size == 1)
|
||||
{
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
return values;
|
||||
}
|
||||
String v2Str = st.nextToken();
|
||||
@ -411,7 +411,7 @@ public class SchedulingPattern
|
||||
{
|
||||
for (int i = v1; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else if (v1 > v2)
|
||||
@ -420,17 +420,17 @@ public class SchedulingPattern
|
||||
int max = parser.getMaxValue();
|
||||
for (int i = v1; i <= max; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
for (int i = min; i <= v2; i++)
|
||||
{
|
||||
values.add(new Integer(i));
|
||||
values.add(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// v1 == v2
|
||||
values.add(new Integer(v1));
|
||||
values.add(v1);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherGS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/game/";
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherLS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobius";
|
||||
final String dir = "sql/login/";
|
||||
|
@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
{
|
||||
Connection _con;
|
||||
|
||||
public DBInstallerConsole(String db, String dir)
|
||||
public DBInstallerConsole(String db, String dir) throws Exception
|
||||
{
|
||||
System.out.println("Welcome to L2J DataBase installer");
|
||||
final Preferences prop = Preferences.userRoot();
|
||||
@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
* @param pass the password
|
||||
* @param database the database name
|
||||
* @param mode the mode, c: Clean, u:update
|
||||
* @throws Exception
|
||||
*/
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode)
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
|
||||
{
|
||||
if ((database == null) || database.isEmpty())
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.commons.util.SplashScreen;
|
||||
import com.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
|
||||
final int height = 220;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
|
||||
|
||||
final ActionListener connectListener = e ->
|
||||
{
|
||||
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
MySqlConnect connector = null;
|
||||
try
|
||||
{
|
||||
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if (connector.getConnection() != null)
|
||||
if ((connector != null) && (connector.getConnection() != null))
|
||||
{
|
||||
_prop.put("dbHost_" + _db, _dbHost.getText());
|
||||
_prop.put("dbPort_" + _db, _dbPort.getText());
|
||||
|
@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
|
||||
|
||||
@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
final int height = 360;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class MySqlConnect
|
||||
{
|
||||
Connection con = null;
|
||||
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
|
||||
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
|
||||
con = DriverManager.getConnection(formattedText, user, password);
|
||||
|
||||
|
Reference in New Issue
Block a user