Commit 50757501 authored by adwisatya's avatar adwisatya
Browse files

Cleaning

parent 2be903fd
#Tue, 28 Apr 2015 17:01:40 +0700
#Tue, 28 Apr 2015 19:46:55 +0700
C\:\\Users\\adwisatya\\Documents\\Semester\ 6\\Tugas\\IF3230\ Sister\\IF3230-Tugas-Besar-Sister-2015\\src\\server=
......@@ -119,7 +119,7 @@ public class Client extends Thread{
System.out.println("Response: "+tmpStr);
}
public void checkCommand(String cmd) throws IOException, NoSuchAlgorithmException, JSONException {
cmdJoin();
//cmdJoin();
System.out.println("Request: " + cmd);
if(utility.isJSONValid(cmd)){
switch (utility.JSONtoString("method",cmd)){
......@@ -186,6 +186,7 @@ public class Client extends Thread{
case "fetchitem":
cmdFetchItem(utility.JSONtoString("token",cmd), utility.JSONtoString("offer_token",cmd));
break;
/* 16 */
case "canceloffer":
cmdCancelOffer(utility.JSONtoString("token",cmd), utility.JSONtoString("offer_token",cmd));
break;
......@@ -201,7 +202,10 @@ public class Client extends Thread{
for(int i = 0; i<objArr.length();i++){
objArr.getJSONObject(i).get("ip");
objArr.getJSONObject(i).get("port");
servers.add(objArr.getJSONObject(i).toString());
if(servers.contains(objArr.getJSONObject(i))){
System.out.println("Masukkan server baru");
servers.add(objArr.getJSONObject(i).toString());
}
}
} catch (JSONException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
......
......@@ -618,7 +618,7 @@ public class Database {
try{
Class.forName(driver);
conn = DriverManager.getConnection(url+dbName,username,password);
statement = conn.prepareStatement("UPDATE `offers` SET `available`=3, WHERE `offer`=? AND `offer_token`=?"); // available code: 3 for cancel
statement = conn.prepareStatement("UPDATE `offers` SET `available`=3 WHERE `token`=? AND `offer_token`=?"); // available code: 3 for cancel
statement.setString(1,_token);
statement.setString(2,_offer_token);
rs = statement.executeUpdate();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment