Browse Source

Improve readability by fixing wrong indentation levels

smackomemoStyleFixes
Paul Schaub 2 months ago
parent
commit
bfaaf1c49f
No known key found for this signature in database GPG Key ID: 62BEE9264BF17311
4 changed files with 21 additions and 23 deletions
  1. +10
    -10
      smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java
  2. +6
    -6
      smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java
  3. +2
    -2
      smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoBundleElement.java
  4. +3
    -5
      smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoMessageBuilder.java

+ 10
- 10
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java View File

@@ -316,9 +316,9 @@ public final class OmemoManager extends Manager {
throws CryptoFailedException, UndecidedOmemoIdentityException,
InterruptedException, SmackException.NotConnectedException,
SmackException.NoResponseException, SmackException.NotLoggedInException, IOException {
Set<BareJid> recipients = new HashSet<>();
recipients.add(recipient);
return encrypt(recipients, message);
Set<BareJid> recipients = new HashSet<>();
recipients.add(recipient);
return encrypt(recipients, message);
}

/**
@@ -506,8 +506,8 @@ public final class OmemoManager extends Manager {
CryptoFailedException, CannotEstablishOmemoSessionException, IOException {
XMPPConnection connection = connection();
MessageBuilder message = connection.getStanzaFactory()
.buildMessageStanza()
.to(recipient.getJid());
.buildMessageStanza()
.to(recipient.getJid());

OmemoElement element = getOmemoService().createRatchetUpdateElement(new LoggedInOmemoManager(this), recipient);
message.addExtension(element);
@@ -751,8 +751,8 @@ public final class OmemoManager extends Manager {
*/
public synchronized void rotateSignedPreKey()
throws CorruptedOmemoKeyException, SmackException.NotLoggedInException, XMPPException.XMPPErrorException,
SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException,
IOException, PubSubException.NotALeafNodeException {
SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException,
IOException, PubSubException.NotALeafNodeException {
if (!connection().isAuthenticated()) {
throw new SmackException.NotLoggedInException();
}
@@ -1037,7 +1037,7 @@ public final class OmemoManager extends Manager {
OmemoDeviceListElement receivedDeviceList = (OmemoDeviceListElement) payloadItem.getPayload();
try {
getOmemoService().getOmemoStoreBackend().mergeCachedDeviceList(getOwnDevice(), from,
receivedDeviceList);
receivedDeviceList);

if (!from.asBareJid().equals(getOwnJid())) {
continue;
@@ -1046,8 +1046,8 @@ public final class OmemoManager extends Manager {
deviceList = getOmemoService().cleanUpDeviceList(getOwnDevice());
} catch (IOException e) {
LOGGER.log(Level.SEVERE,
"IOException while processing OMEMO PEP device updates. Message: " + message,
e);
"IOException while processing OMEMO PEP device updates. Message: " + message,
e);
continue;
}
final OmemoDeviceListElement_VAxolotl newDeviceList = new OmemoDeviceListElement_VAxolotl(deviceList);


+ 6
- 6
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java View File

@@ -1141,8 +1141,8 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
OmemoBundleElement bundleElement = getOmemoStoreBackend().packOmemoBundle(userDevice);
publishBundle(manager.getConnection(), userDevice, bundleElement);
} catch (CorruptedOmemoKeyException | InterruptedException | SmackException.NoResponseException
| SmackException.NotConnectedException | XMPPException.XMPPErrorException
| NotALeafNodeException e) {
| SmackException.NotConnectedException | XMPPException.XMPPErrorException
| NotALeafNodeException e) {
LOGGER.log(Level.WARNING, "Could not republish replenished bundle.", e);
}
}
@@ -1224,8 +1224,8 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
OmemoBundleElement bundleElement = getOmemoStoreBackend().packOmemoBundle(userDevice);
publishBundle(manager.getConnection(), userDevice, bundleElement);
} catch (CorruptedOmemoKeyException | InterruptedException | SmackException.NoResponseException
| SmackException.NotConnectedException | XMPPException.XMPPErrorException
| NotALeafNodeException e) {
| SmackException.NotConnectedException | XMPPException.XMPPErrorException
| NotALeafNodeException e) {
LOGGER.log(Level.WARNING, "Could not republish replenished bundle.", e);
}
}
@@ -1307,8 +1307,8 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
OmemoBundleElement bundleElement = getOmemoStoreBackend().packOmemoBundle(userDevice);
publishBundle(manager.getConnection(), userDevice, bundleElement);
} catch (CorruptedOmemoKeyException | InterruptedException | SmackException.NoResponseException
| SmackException.NotConnectedException | XMPPException.XMPPErrorException
| NotALeafNodeException e) {
| SmackException.NotConnectedException | XMPPException.XMPPErrorException
| NotALeafNodeException e) {
LOGGER.log(Level.WARNING, "Could not republish replenished bundle.", e);
}
}


+ 2
- 2
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoBundleElement.java View File

@@ -216,9 +216,9 @@ public abstract class OmemoBundleElement implements ExtensionElement {
.append(IDENTITY_KEY).append(": ").append(identityKeyB64).append('\n')
.append(PRE_KEYS).append(" (").append(preKeysB64.size()).append(")\n");
for (Map.Entry<Integer, String> e : preKeysB64.entrySet()) {
sb.append(PRE_KEY_PUB).append(' ').append(PRE_KEY_ID).append("=").append(e.getKey()).append(": ").append(e.getValue()).append("\n");
sb.append(PRE_KEY_PUB).append(' ').append(PRE_KEY_ID).append('=').append(e.getKey()).append(": ").append(e.getValue()).append('\n');
}
sb.append("]");
sb.append(']');
return sb.toString();
}



+ 3
- 5
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoMessageBuilder.java View File

@@ -26,10 +26,8 @@ import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.SecureRandom;
import java.util.ArrayList;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
@@ -156,8 +154,8 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
* @throws IllegalBlockSizeException if the input data length is incorrect.
*/
private void setMessage(String message)
throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException,
InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException,
InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
if (message == null) {
return;
}
@@ -203,7 +201,7 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_

if (cipherTextWithoutAuthTag.length != cipherText.length - 16) {
throw new IllegalArgumentException("Length of cipherTextWithoutAuthTag must be length of cipherText " +
"- length of AuthTag (16)");
"- length of AuthTag (16)");
}

// Move auth tag from cipherText to messageKey


Loading…
Cancel
Save