diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/generation/KeyRingBuilder.java b/pgpainless-core/src/main/java/org/pgpainless/key/generation/KeyRingBuilder.java index 398b369d..20e6c484 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/generation/KeyRingBuilder.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/generation/KeyRingBuilder.java @@ -26,7 +26,6 @@ import java.util.Date; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; -import java.util.Objects; import java.util.Set; import javax.annotation.Nonnull; @@ -53,6 +52,7 @@ import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder; import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder; import org.pgpainless.algorithm.HashAlgorithm; import org.pgpainless.algorithm.KeyFlag; +import org.pgpainless.algorithm.SignatureType; import org.pgpainless.key.collection.PGPKeyRing; import org.pgpainless.key.generation.type.ECDH; import org.pgpainless.key.generation.type.ECDSA; @@ -215,7 +215,7 @@ public class KeyRingBuilder implements KeyRingBuilderInterface { @Override public WithAdditionalUserIdOrPassphrase withAdditionalUserId(@Nonnull String userId) { - if (Objects.equals(KeyRingBuilder.this.userId, userId)) { + if (KeyRingBuilder.this.userId.equals(userId)) { throw new IllegalArgumentException("Additional user-id MUST NOT be equal to primary user-id."); } KeyRingBuilder.this.additionalUserIds.add(userId); diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/generation/KeyRingBuilderInterface.java b/pgpainless-core/src/main/java/org/pgpainless/key/generation/KeyRingBuilderInterface.java index 133aa1bf..8cda9eba 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/generation/KeyRingBuilderInterface.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/generation/KeyRingBuilderInterface.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Paul Schaub. + * Copyright 2018-2020 Paul Schaub. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java index 425bc955..a518cecd 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Paul Schaub. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.pgpainless.key.generation; import static org.junit.Assert.assertEquals; @@ -43,6 +58,8 @@ public class GenerateKeyWithAdditionalUserIdTest { armor.close(); // echo this | gpg --list-packets + // CHECKSTYLE:OFF System.out.println(byteOut.toString("UTF-8")); + // CHECKSTYLE:ON } }