mirror of
https://github.com/aljazceru/signal-cli.git
synced 2025-12-25 10:04:23 +01:00
Improve logging in prekey store
This commit is contained in:
@@ -49,7 +49,7 @@ public class PreKeyStore implements org.signal.libsignal.protocol.state.PreKeySt
|
||||
public PreKeyRecord loadPreKey(int preKeyId) throws InvalidKeyIdException {
|
||||
final var preKey = getPreKey(preKeyId);
|
||||
if (preKey == null) {
|
||||
throw new InvalidKeyIdException("No such signed pre key record!");
|
||||
throw new InvalidKeyIdException("No such signed pre key record: " + preKeyId);
|
||||
}
|
||||
return preKey;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class PreKeyStore implements org.signal.libsignal.protocol.state.PreKeySt
|
||||
try (final var connection = database.getConnection()) {
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
statement.setInt(1, accountIdType);
|
||||
statement.setLong(2, preKeyId);
|
||||
statement.setInt(2, preKeyId);
|
||||
final var keyPair = record.getKeyPair();
|
||||
statement.setBytes(3, keyPair.getPublicKey().serialize());
|
||||
statement.setBytes(4, keyPair.getPrivateKey().serialize());
|
||||
@@ -93,7 +93,7 @@ public class PreKeyStore implements org.signal.libsignal.protocol.state.PreKeySt
|
||||
try (final var connection = database.getConnection()) {
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
statement.setInt(1, accountIdType);
|
||||
statement.setLong(2, preKeyId);
|
||||
statement.setInt(2, preKeyId);
|
||||
statement.executeUpdate();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
@@ -137,7 +137,7 @@ public class PreKeyStore implements org.signal.libsignal.protocol.state.PreKeySt
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
for (final var record : preKeys) {
|
||||
statement.setInt(1, accountIdType);
|
||||
statement.setLong(2, record.getId());
|
||||
statement.setInt(2, record.getId());
|
||||
final var keyPair = record.getKeyPair();
|
||||
statement.setBytes(3, keyPair.getPublicKey().serialize());
|
||||
statement.setBytes(4, keyPair.getPrivateKey().serialize());
|
||||
@@ -163,7 +163,7 @@ public class PreKeyStore implements org.signal.libsignal.protocol.state.PreKeySt
|
||||
try (final var connection = database.getConnection()) {
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
statement.setInt(1, accountIdType);
|
||||
statement.setLong(2, preKeyId);
|
||||
statement.setInt(2, preKeyId);
|
||||
return Utils.executeQueryForOptional(statement, this::getPreKeyRecordFromResultSet).orElse(null);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SignedPreKeyStore implements org.signal.libsignal.protocol.state.Si
|
||||
public SignedPreKeyRecord loadSignedPreKey(int signedPreKeyId) throws InvalidKeyIdException {
|
||||
final SignedPreKeyRecord signedPreKeyRecord = getSignedPreKey(signedPreKeyId);
|
||||
if (signedPreKeyRecord == null) {
|
||||
throw new InvalidKeyIdException("No such signed pre key record!");
|
||||
throw new InvalidKeyIdException("No such signed pre key record: " + signedPreKeyId);
|
||||
}
|
||||
return signedPreKeyRecord;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class SignedPreKeyStore implements org.signal.libsignal.protocol.state.Si
|
||||
try (final var connection = database.getConnection()) {
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
statement.setInt(1, accountIdType);
|
||||
statement.setLong(2, signedPreKeyId);
|
||||
statement.setInt(2, signedPreKeyId);
|
||||
final var keyPair = record.getKeyPair();
|
||||
statement.setBytes(3, keyPair.getPublicKey().serialize());
|
||||
statement.setBytes(4, keyPair.getPrivateKey().serialize());
|
||||
@@ -119,7 +119,7 @@ public class SignedPreKeyStore implements org.signal.libsignal.protocol.state.Si
|
||||
try (final var connection = database.getConnection()) {
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
statement.setInt(1, accountIdType);
|
||||
statement.setLong(2, signedPreKeyId);
|
||||
statement.setInt(2, signedPreKeyId);
|
||||
statement.executeUpdate();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
@@ -163,7 +163,7 @@ public class SignedPreKeyStore implements org.signal.libsignal.protocol.state.Si
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
for (final var record : signedPreKeys) {
|
||||
statement.setInt(1, accountIdType);
|
||||
statement.setLong(2, record.getId());
|
||||
statement.setInt(2, record.getId());
|
||||
final var keyPair = record.getKeyPair();
|
||||
statement.setBytes(3, keyPair.getPublicKey().serialize());
|
||||
statement.setBytes(4, keyPair.getPrivateKey().serialize());
|
||||
@@ -190,7 +190,7 @@ public class SignedPreKeyStore implements org.signal.libsignal.protocol.state.Si
|
||||
try (final var connection = database.getConnection()) {
|
||||
try (final var statement = connection.prepareStatement(sql)) {
|
||||
statement.setInt(1, accountIdType);
|
||||
statement.setLong(2, signedPreKeyId);
|
||||
statement.setInt(2, signedPreKeyId);
|
||||
return Utils.executeQueryForOptional(statement, this::getSignedPreKeyRecordFromResultSet).orElse(null);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
||||
Reference in New Issue
Block a user