Update to new generified Bouncy Castle APIs

Change-Id: I6a1b0657467c8890f48e7afac82a13cdf8fdf0e3
This commit is contained in:
Dave Borowitz 2017-06-26 15:48:37 -04:00
parent b323e9dfe1
commit f09980eea7
8 changed files with 3 additions and 10 deletions

View File

@ -1174,7 +1174,6 @@ public class AccountIT extends AbstractDaemonTest {
assertThat(actual.fingerprint)
.named(id)
.isEqualTo(Fingerprint.toString(expected.getPublicKey().getFingerprint()));
@SuppressWarnings("unchecked")
List<String> userIds = ImmutableList.copyOf(expected.getPublicKey().getUserIDs());
assertThat(actual.userIds).named(id).containsExactlyElementsIn(userIds);
assertThat(actual.key).named(id).startsWith("-----BEGIN PGP PUBLIC KEY BLOCK-----\n");

View File

@ -176,7 +176,6 @@ public class GerritPublicKeyChecker extends PublicKeyChecker {
private boolean hasAllowedUserId(PGPPublicKey key, Set<String> allowedUserIds)
throws PGPException {
@SuppressWarnings("unchecked")
Iterator<String> userIds = key.getUserIDs();
while (userIds.hasNext()) {
String userId = userIds.next();

View File

@ -381,7 +381,6 @@ public class PublicKeyChecker {
}
List<CheckResult> signerResults = new ArrayList<>();
@SuppressWarnings("unchecked")
Iterator<String> userIds = key.getUserIDs();
while (userIds.hasNext()) {
String userId = userIds.next();

View File

@ -398,7 +398,6 @@ public class PublicKeyStore implements AutoCloseable {
}
public static String keyToString(PGPPublicKey key) {
@SuppressWarnings("unchecked")
Iterator<String> it = key.getUserIDs();
return String.format(
"%s %s(%s)",

View File

@ -219,7 +219,6 @@ public class GpgKeys implements ChildCollection<AccountResource, GpgKey> {
if (key != null) {
info.id = PublicKeyStore.keyIdToString(key.getKeyID());
info.fingerprint = Fingerprint.toString(key.getFingerprint());
@SuppressWarnings("unchecked")
Iterator<String> userIds = key.getUserIDs();
info.userIds = ImmutableList.copyOf(userIds);

View File

@ -374,7 +374,7 @@ public class GerritPublicKeyCheckerTest {
PGPPublicKeyRing keyRingB = keyB().getPublicKeyRing();
PGPPublicKey keyB = keyRingB.getPublicKey();
keyB = PGPPublicKey.removeCertification(keyB, (String) keyB.getUserIDs().next());
keyB = PGPPublicKey.removeCertification(keyB, keyB.getUserIDs().next());
keyRingB = PGPPublicKeyRing.insertPublicKey(keyRingB, keyB);
add(keyRingB, addUser("userB"));
@ -392,8 +392,7 @@ public class GerritPublicKeyCheckerTest {
List<ExternalId> newExtIds = new ArrayList<>(2);
newExtIds.add(ExternalId.create(toExtIdKey(kr.getPublicKey()), id));
@SuppressWarnings("unchecked")
String userId = (String) Iterators.getOnlyElement(kr.getPublicKey().getUserIDs(), null);
String userId = Iterators.getOnlyElement(kr.getPublicKey().getUserIDs(), null);
if (userId != null) {
String email = PushCertificateIdent.parse(userId).getEmailAddress();
assertThat(email).contains("@");

View File

@ -231,7 +231,6 @@ public class PublicKeyStoreTest {
private void assertUserIds(PGPPublicKeyRing keyRing, String... expected) throws Exception {
List<String> actual = new ArrayList<>();
@SuppressWarnings("unchecked")
Iterator<String> userIds =
store.get(keyRing.getPublicKey().getKeyID()).iterator().next().getPublicKey().getUserIDs();
while (userIds.hasNext()) {

View File

@ -77,7 +77,7 @@ public class TestKey {
}
public String getFirstUserId() {
return (String) getPublicKey().getUserIDs().next();
return getPublicKey().getUserIDs().next();
}
public PGPPrivateKey getPrivateKey() throws PGPException {