Commit 571596f1 authored by Lachesis Chiang's avatar Lachesis Chiang

Fix implementation bug for XEP0049. The comment in Line 105: "If the name and...

Fix implementation bug for XEP0049. The comment in Line 105: "If the name and namespace of the element matches another" is correct, but the implementation is wrong, it checks "username and namespace" rather than "name and namespace".
parent 052ede3f
......@@ -53,11 +53,11 @@ public class PrivateStorage extends BasicModule implements UserEventListener {
private static final Logger Log = LoggerFactory.getLogger(PrivateStorage.class);
private static final String LOAD_PRIVATE =
"SELECT privateData FROM ofPrivate WHERE username=? AND namespace=?";
"SELECT privateData FROM ofPrivate WHERE name=? AND namespace=?";
private static final String INSERT_PRIVATE =
"INSERT INTO ofPrivate (privateData,name,username,namespace) VALUES (?,?,?,?)";
"INSERT INTO ofPrivate (privateData, name, username, namespace) VALUES (?,?,?,?)";
private static final String UPDATE_PRIVATE =
"UPDATE ofPrivate SET privateData=?, name=? WHERE username=? AND namespace=?";
"UPDATE ofPrivate SET privateData=? WHERE name=? AND username=? AND namespace=?";
private static final String DELETE_PRIVATES =
"DELETE FROM ofPrivate WHERE username=?";
......@@ -118,7 +118,7 @@ public class PrivateStorage extends BasicModule implements UserEventListener {
data.write(writer);
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_PRIVATE);
pstmt.setString(1, username);
pstmt.setString(1, data.getName());
pstmt.setString(2, data.getNamespaceURI());
rs = pstmt.executeQuery();
boolean update = false;
......
Markdown is supported
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