mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
* Added to all toUpperCase/toLowerCase calls the Locale.ENGLISH to prevent problems with some languages (e.g. Turkish). Removed some unused import statements. (#4634).
This commit is contained in:
parent
03ebdc17d8
commit
b073ce1c42
147 changed files with 1419 additions and 1496 deletions
|
|
@ -24,21 +24,15 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* ConnectDialog.java
|
||||
*
|
||||
* Created on 20-Jan-2010, 9:37:07 PM
|
||||
*/
|
||||
|
||||
package mage.server.console;
|
||||
|
||||
import mage.remote.Connection;
|
||||
import mage.remote.Connection.ProxyType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
@ -46,8 +40,13 @@ import java.net.URL;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.*;
|
||||
import mage.remote.Connection;
|
||||
import mage.remote.Connection.ProxyType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -60,9 +59,11 @@ public class ConnectDialog extends JDialog {
|
|||
private Connection connection;
|
||||
private ConnectTask task;
|
||||
|
||||
/** Creates new form ConnectDialog */
|
||||
/**
|
||||
* Creates new form ConnectDialog
|
||||
*/
|
||||
public ConnectDialog() {
|
||||
initComponents();
|
||||
initComponents();
|
||||
cbProxyType.setModel(new DefaultComboBoxModel(Connection.ProxyType.values()));
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +74,7 @@ public class ConnectDialog extends JDialog {
|
|||
this.chkAutoConnect.setSelected(Boolean.parseBoolean(ConsoleFrame.getPreferences().get("autoConnect", "false")));
|
||||
this.txtProxyServer.setText(ConsoleFrame.getPreferences().get("proxyAddress", "localhost"));
|
||||
this.txtProxyPort.setText(ConsoleFrame.getPreferences().get("proxyPort", Integer.toString(17171)));
|
||||
this.cbProxyType.setSelectedItem(Connection.ProxyType.valueOf(ConsoleFrame.getPreferences().get("proxyType", "NONE").toUpperCase()));
|
||||
this.cbProxyType.setSelectedItem(Connection.ProxyType.valueOf(ConsoleFrame.getPreferences().get("proxyType", "NONE").toUpperCase(Locale.ENGLISH)));
|
||||
this.txtProxyUserName.setText(ConsoleFrame.getPreferences().get("proxyUsername", ""));
|
||||
this.txtPasswordField.setText(ConsoleFrame.getPreferences().get("proxyPassword", ""));
|
||||
this.showProxySettings();
|
||||
|
|
@ -87,13 +88,11 @@ public class ConnectDialog extends JDialog {
|
|||
this.pnlProxy.setVisible(true);
|
||||
this.pnlProxyAuth.setVisible(false);
|
||||
this.pnlProxySettings.setVisible(true);
|
||||
}
|
||||
else if (cbProxyType.getSelectedItem() == Connection.ProxyType.HTTP) {
|
||||
} else if (cbProxyType.getSelectedItem() == Connection.ProxyType.HTTP) {
|
||||
this.pnlProxy.setVisible(true);
|
||||
this.pnlProxyAuth.setVisible(true);
|
||||
this.pnlProxySettings.setVisible(true);
|
||||
}
|
||||
else if (cbProxyType.getSelectedItem() == Connection.ProxyType.NONE) {
|
||||
} else if (cbProxyType.getSelectedItem() == Connection.ProxyType.NONE) {
|
||||
this.pnlProxy.setVisible(false);
|
||||
this.pnlProxyAuth.setVisible(false);
|
||||
this.pnlProxySettings.setVisible(false);
|
||||
|
|
@ -115,10 +114,10 @@ public class ConnectDialog extends JDialog {
|
|||
Arrays.fill(input, '0');
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
|
@ -377,7 +376,7 @@ public class ConnectDialog extends JDialog {
|
|||
JOptionPane.showMessageDialog(rootPane, "Please provide a port number");
|
||||
return;
|
||||
}
|
||||
if (Integer.valueOf(txtPort.getText()) < 1 || Integer.valueOf(txtPort.getText()) > 65535 ) {
|
||||
if (Integer.valueOf(txtPort.getText()) < 1 || Integer.valueOf(txtPort.getText()) > 65535) {
|
||||
JOptionPane.showMessageDialog(rootPane, "Invalid port number");
|
||||
txtPort.setText(ConsoleFrame.getPreferences().get("serverPort", Integer.toString(17171)));
|
||||
return;
|
||||
|
|
@ -424,15 +423,15 @@ public class ConnectDialog extends JDialog {
|
|||
if (result) {
|
||||
lblStatus.setText("");
|
||||
connected();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lblStatus.setText("Could not connect");
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
logger.fatal("Update Players Task error", ex);
|
||||
} catch (ExecutionException ex) {
|
||||
logger.fatal("Update Players Task error", ex);
|
||||
} catch (CancellationException ex) {}
|
||||
} catch (CancellationException ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -441,7 +440,6 @@ public class ConnectDialog extends JDialog {
|
|||
this.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
private void keyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_keyTyped
|
||||
char c = evt.getKeyChar();
|
||||
if (!Character.isDigit(c)) {
|
||||
|
|
@ -467,7 +465,7 @@ public class ConnectDialog extends JDialog {
|
|||
List<String> servers = new ArrayList<>();
|
||||
String inputLine;
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
System.out.println("Found server: "+inputLine);
|
||||
System.out.println("Found server: " + inputLine);
|
||||
servers.add(inputLine);
|
||||
}
|
||||
|
||||
|
|
@ -491,11 +489,14 @@ public class ConnectDialog extends JDialog {
|
|||
}
|
||||
|
||||
in.close();
|
||||
} catch(Exception ex) {
|
||||
logger.error(ex,ex);
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex, ex);
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try { in.close(); } catch (Exception e) {}
|
||||
try {
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
|
@ -505,10 +506,9 @@ public class ConnectDialog extends JDialog {
|
|||
}//GEN-LAST:event_cbProxyTypeActionPerformed
|
||||
|
||||
private void txtPasswordFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPasswordFieldActionPerformed
|
||||
// TODO add your handling code here:
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_txtPasswordFieldActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnCancel;
|
||||
private javax.swing.JButton btnConnect;
|
||||
|
|
|
|||
|
|
@ -608,7 +608,7 @@ class UpdateUsersTask extends SwingWorker<Void, List<UserView>> {
|
|||
if (!panel.getjUserName().getText().equals("")) {
|
||||
List<UserView> users2 = new ArrayList<>();
|
||||
for (UserView user : users) {
|
||||
if (user.getUserName().toUpperCase().matches(".*" + panel.getjUserName().getText().toUpperCase() + ".*")) {
|
||||
if (user.getUserName().toUpperCase(Locale.ENGLISH).matches(".*" + panel.getjUserName().getText().toUpperCase(Locale.ENGLISH) + ".*")) {
|
||||
users2.add(user);
|
||||
}
|
||||
}
|
||||
|
|
@ -697,7 +697,7 @@ class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
|
|||
if (!panel.getjUserName().getText().equals("")) {
|
||||
Collection<TableView> tableViews2 = new ArrayList<>();
|
||||
for (TableView table : tableViews) {
|
||||
if (table.getControllerName().toUpperCase().matches(".*" + panel.getjUserName().getText().toUpperCase() + ".*")) {
|
||||
if (table.getControllerName().toUpperCase(Locale.ENGLISH).matches(".*" + panel.getjUserName().getText().toUpperCase(Locale.ENGLISH) + ".*")) {
|
||||
tableViews2.add(table);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue