From 3b5fc6e8a572c5f554a8cc89d97e7bc48ce2a2e4 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 1 Aug 2008 12:16:16 +0000 Subject: Client: Removed deprecated function from Step2.java --- .../src/com/fourisland/instadisc/FirstRun/Step2.java | 18 +++++++----------- .../trunk/src/com/fourisland/instadisc/Item/MD5.java | 11 +++++++++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java index 6831417..719f27d 100644 --- a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java @@ -143,12 +143,7 @@ public class Step2 extends javax.swing.JDialog { if (jTextField1.getText().equals("")) { jLabel5.setText("Error: You forgot to enter a username"); } else { - /* TODO: Replace deprecated JPasswordField.getText() with - * JPasswordField.getPassword(). However, getPassword() - * returns the password in a char[], not a String, so - * it must be parsed prior to use. - */ - if (jPasswordField1.getText().equals("")) { + if (jPasswordField1.getPassword().length == 0) { jLabel5.setText("Error: You forgot to enter a password"); } else { if (jTextField3.getText().equals("")) { @@ -157,17 +152,18 @@ public class Step2 extends javax.swing.JDialog { try { URL url = new URL(jTextField3.getText()); - XmlRpc xmlrpc = new XmlRpc("checkRegistration", jTextField3.getText(), jTextField1.getText(), jPasswordField1.getText()); + MD5 md5 = new MD5(jPasswordField1.getPassword()); + String password = md5.hash(); + + XmlRpc xmlrpc = new XmlRpc("checkRegistration", jTextField3.getText(), jTextField1.getText(), password); Integer r = (Integer) xmlrpc.execute(); if (r == 1) { jLabel5.setText("Error: No registration exists on the specified Central Server with the specified UN/PW combination"); - } else { - MD5 md5 = new MD5(jPasswordField1.getText()); - + } else { Wrapper.setConfig("username", jTextField1.getText()); - Wrapper.setConfig("password", md5.hash()); + Wrapper.setConfig("password", password); Wrapper.setConfig("centralServerURL", jTextField3.getText()); Wrapper.setConfig("itemBufferSize", "10"); Wrapper.setConfig("verIDBufferSize", "100"); diff --git a/client/trunk/src/com/fourisland/instadisc/Item/MD5.java b/client/trunk/src/com/fourisland/instadisc/Item/MD5.java index 9c4d5aa..7c2096c 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/MD5.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/MD5.java @@ -20,6 +20,16 @@ public class MD5 { this.ver = ver; } + public MD5(char[] password) { + int i=0; + ver=""; + for (i=0;i