Equals method must be symmetric and transitive.

This commit is contained in:
akwizgran
2012-12-09 20:29:29 +00:00
parent a97dc0de6b
commit 15ab5be476
8 changed files with 38 additions and 33 deletions

View File

@@ -1207,7 +1207,7 @@ abstract class JdbcDatabase implements Database<Connection> {
t = new Transport(id);
transports.add(t);
}
t.put(rs.getString(2), rs.getString(3));
t.getProperties().put(rs.getString(2), rs.getString(3));
lastId = id;
}
rs.close();
@@ -2763,7 +2763,7 @@ abstract class JdbcDatabase implements Database<Connection> {
int batchSize = 0;
for(Transport t : transports) {
ps.setBytes(2, t.getId().getBytes());
for(Entry<String, String> e1 : t.entrySet()) {
for(Entry<String, String> e1 : t.getProperties().entrySet()) {
ps.setString(3, e1.getKey());
ps.setString(4, e1.getValue());
ps.addBatch();

View File

@@ -27,13 +27,13 @@ class GroupImpl implements Group {
return publicKey;
}
@Override
public boolean equals(Object o) {
return o instanceof Group && id.equals(((Group) o).getId());
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public boolean equals(Object o) {
return o instanceof Group && id.equals(((Group) o).getId());
}
}

View File

@@ -71,13 +71,13 @@ class MessageImpl implements Message {
return bodyLength;
}
@Override
public boolean equals(Object o) {
return o instanceof Message && id.equals(((Message) o).getId());
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public boolean equals(Object o) {
return o instanceof Message && id.equals(((Message) o).getId());
}
}

View File

@@ -148,7 +148,7 @@ class ProtocolWriterImpl implements ProtocolWriter {
for(Transport p : t.getTransports()) {
w.writeStructId(Types.TRANSPORT);
w.writeBytes(p.getId().getBytes());
w.writeMap(p);
w.writeMap(p.getProperties());
}
w.writeListEnd();
w.writeInt64(t.getTimestamp());