diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-01 12:16:16 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-01 12:16:16 +0000 |
commit | 3b5fc6e8a572c5f554a8cc89d97e7bc48ce2a2e4 (patch) | |
tree | 6cacc6f4bf8f155086f8f9ea18ce4add46a78298 | |
parent | 13263b90fa105971aba997b2ca39180f889533ef (diff) | |
download | instadisc-3b5fc6e8a572c5f554a8cc89d97e7bc48ce2a2e4.tar.gz instadisc-3b5fc6e8a572c5f554a8cc89d97e7bc48ce2a2e4.tar.bz2 instadisc-3b5fc6e8a572c5f554a8cc89d97e7bc48ce2a2e4.zip |
Client: Removed deprecated function from Step2.java
-rw-r--r-- | client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java | 18 | ||||
-rw-r--r-- | client/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 { | |||
143 | if (jTextField1.getText().equals("")) { | 143 | if (jTextField1.getText().equals("")) { |
144 | jLabel5.setText("Error: You forgot to enter a username"); | 144 | jLabel5.setText("Error: You forgot to enter a username"); |
145 | } else { | 145 | } else { |
146 | /* TODO: Replace deprecated JPasswordField.getText() with | 146 | if (jPasswordField1.getPassword().length == 0) { |
147 | * JPasswordField.getPassword(). However, getPassword() | ||
148 | * returns the password in a char[], not a String, so | ||
149 | * it must be parsed prior to use. | ||
150 | */ | ||
151 | if (jPasswordField1.getText().equals("")) { | ||
152 | jLabel5.setText("Error: You forgot to enter a password"); | 147 | jLabel5.setText("Error: You forgot to enter a password"); |
153 | } else { | 148 | } else { |
154 | if (jTextField3.getText().equals("")) { | 149 | if (jTextField3.getText().equals("")) { |
@@ -157,17 +152,18 @@ public class Step2 extends javax.swing.JDialog { | |||
157 | try { | 152 | try { |
158 | URL url = new URL(jTextField3.getText()); | 153 | URL url = new URL(jTextField3.getText()); |
159 | 154 | ||
160 | XmlRpc xmlrpc = new XmlRpc("checkRegistration", jTextField3.getText(), jTextField1.getText(), jPasswordField1.getText()); | 155 | MD5 md5 = new MD5(jPasswordField1.getPassword()); |
156 | String password = md5.hash(); | ||
157 | |||
158 | XmlRpc xmlrpc = new XmlRpc("checkRegistration", jTextField3.getText(), jTextField1.getText(), password); | ||
161 | Integer r = (Integer) xmlrpc.execute(); | 159 | Integer r = (Integer) xmlrpc.execute(); |
162 | 160 | ||
163 | if (r == 1) | 161 | if (r == 1) |
164 | { | 162 | { |
165 | jLabel5.setText("Error: No registration exists on the specified Central Server with the specified UN/PW combination"); | 163 | jLabel5.setText("Error: No registration exists on the specified Central Server with the specified UN/PW combination"); |
166 | } else { | 164 | } else { |
167 | MD5 md5 = new MD5(jPasswordField1.getText()); | ||
168 | |||
169 | Wrapper.setConfig("username", jTextField1.getText()); | 165 | Wrapper.setConfig("username", jTextField1.getText()); |
170 | Wrapper.setConfig("password", md5.hash()); | 166 | Wrapper.setConfig("password", password); |
171 | Wrapper.setConfig("centralServerURL", jTextField3.getText()); | 167 | Wrapper.setConfig("centralServerURL", jTextField3.getText()); |
172 | Wrapper.setConfig("itemBufferSize", "10"); | 168 | Wrapper.setConfig("itemBufferSize", "10"); |
173 | Wrapper.setConfig("verIDBufferSize", "100"); | 169 | 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 { | |||
20 | this.ver = ver; | 20 | this.ver = ver; |
21 | } | 21 | } |
22 | 22 | ||
23 | public MD5(char[] password) { | ||
24 | int i=0; | ||
25 | ver=""; | ||
26 | for (i=0;i<password.length;i++) | ||
27 | { | ||
28 | ver += password[i]; | ||
29 | password[i] = 0; | ||
30 | } | ||
31 | } | ||
32 | |||
23 | public String hash() | 33 | public String hash() |
24 | { | 34 | { |
25 | StringBuilder verify = new StringBuilder(); | 35 | StringBuilder verify = new StringBuilder(); |
@@ -38,6 +48,7 @@ public class MD5 { | |||
38 | } catch (Exception ex) { | 48 | } catch (Exception ex) { |
39 | Logger.getLogger(WellFormedItem.class.getName()).log(Level.SEVERE, null, ex); | 49 | Logger.getLogger(WellFormedItem.class.getName()).log(Level.SEVERE, null, ex); |
40 | } | 50 | } |
51 | ver = ""; | ||
41 | return verify.toString(); | 52 | return verify.toString(); |
42 | } | 53 | } |
43 | 54 | ||