Merge "Treat NoSuchAlgorithmException consistently as IllegalStateException"
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user