github - minor formatting.
@@ -417,35 +417,46 @@ public static PGPSecretKeyRing replacePublicKeys(PGPSecretKeyRing secretRing, PG
* @param publicKey public key to insert or replace
* @return secret key ring
*/
- public static PGPSecretKeyRing insertOrReplacePublicKey(PGPSecretKeyRing secretRing, PGPPublicKey publicKey) {
+ public static PGPSecretKeyRing insertOrReplacePublicKey(PGPSecretKeyRing secretRing, PGPPublicKey publicKey)
+ {
PGPSecretKey secretKey = secretRing.getSecretKey(publicKey.getKeyID());
- if (secretKey != null) {
- List<PGPSecretKey> newList = new ArrayList<>(secretRing.keys.size());
- for (Iterator<PGPSecretKey> it = secretRing.getSecretKeys(); it.hasNext();) {
+ if (secretKey != null)
+ {
+ List<PGPSecretKey> newList = new ArrayList<PGPSecretKey>(secretRing.keys.size());
+ for (Iterator<PGPSecretKey> it = secretRing.getSecretKeys(); it.hasNext(); )
+ {
PGPSecretKey sk = it.next();
- if (sk.getKeyID() == publicKey.getKeyID()) {
+ if (sk.getKeyID() == publicKey.getKeyID())
+ {
sk = PGPSecretKey.replacePublicKey(secretKey, publicKey);
newList.add(sk);
}
}
return new PGPSecretKeyRing(newList);
- } else {
- List<PGPPublicKey> extras = new ArrayList<>(secretRing.extraPubKeys.size());
+ }
+ else
+ {
+ List<PGPPublicKey> extras = new ArrayList<PGPPublicKey>(secretRing.extraPubKeys.size());
boolean found = false;
- for (Iterator<PGPPublicKey> it = secretRing.getExtraPublicKeys(); it.hasNext();) {
+ for (Iterator<PGPPublicKey> it = secretRing.getExtraPublicKeys(); it.hasNext(); )
+ {
PGPPublicKey pk = it.next();
- if (pk.getKeyID() == publicKey.getKeyID()) {
+ if (pk.getKeyID() == publicKey.getKeyID())
+ {
extras.add(publicKey);
found = true;
- } else {
+ }
+ else
+ {
extras.add(pk);
}
}
- if (!found) {
+ if (!found)
+ {
extras.add(publicKey);
}
