Address review comments for detecting duplicate (pending) contacts

This commit is contained in:
Torsten Grote
2019-10-16 11:15:14 -03:00
parent aa0937e6aa
commit 397afbfec0
4 changed files with 13 additions and 5 deletions

View File

@@ -173,6 +173,7 @@ class ContactManagerImpl implements ContactManager, EventListener {
}
@Override
@Nullable
public PendingContactState getPendingContactState(PendingContactId p) {
return states.get(p);
}

View File

@@ -1480,7 +1480,11 @@ abstract class JdbcDatabase implements Database<Connection> {
ps.setBytes(1, handshakePublicKey.getEncoded());
ps.setBytes(2, localAuthorId.getBytes());
rs = ps.executeQuery();
if (!rs.next()) return null;
if (!rs.next()) {
rs.close();
ps.close();
return null;
}
ContactId contactId = new ContactId(rs.getInt(1));
AuthorId authorId = new AuthorId(rs.getBytes(2));
int formatVersion = rs.getInt(3);
@@ -1488,7 +1492,7 @@ abstract class JdbcDatabase implements Database<Connection> {
String alias = rs.getString(5);
PublicKey publicKey = new SignaturePublicKey(rs.getBytes(6));
boolean verified = rs.getBoolean(7);
if (rs.next()) throw new DbException();
if (rs.next()) throw new DbStateException();
rs.close();
ps.close();
Author author =