Merge "Treat NoSuchAlgorithmException consistently as IllegalStateException"

This commit is contained in:
David Pursehouse
2020-02-04 00:56:07 +00:00
committed by Gerrit Code Review
5 changed files with 5 additions and 5 deletions

View File

@@ -237,7 +237,7 @@ class OAuthSession {
try {
return SecureRandom.getInstance("SHA1PRNG");
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("No SecureRandom available for GitHub authentication", e);
throw new IllegalStateException("No SecureRandom available for GitHub authentication", e);
}
}

View File

@@ -222,7 +222,7 @@ class OAuthSessionOverOpenID {
try {
return SecureRandom.getInstance("SHA1PRNG");
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("No SecureRandom available for GitHub authentication", e);
throw new IllegalStateException("No SecureRandom available for GitHub authentication", e);
}
}

View File

@@ -234,7 +234,7 @@ public class FromAddressGeneratorProvider implements Provider<FromAddressGenerat
byte[] bytes = hash.digest(data.getBytes(UTF_8));
return BaseEncoding.base64Url().encode(bytes);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("No MD5 available", e);
throw new IllegalStateException("No MD5 available", e);
}
}
}

View File

@@ -68,7 +68,7 @@ public class PutHttpPassword implements RestModifyView<AccountResource, HttpPass
try {
rng = SecureRandom.getInstance("SHA1PRNG");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Cannot create RNG for password generator", e);
throw new IllegalStateException("Cannot create RNG for password generator", e);
}
}

View File

@@ -34,7 +34,7 @@ public class CommitMessageUtil {
try {
rng = SecureRandom.getInstance("SHA1PRNG");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Cannot create RNG for Change-Id generator", e);
throw new IllegalStateException("Cannot create RNG for Change-Id generator", e);
}
}