mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Replace switch with if
This commit is contained in:
parent
1adfd3d6cd
commit
de9836d0de
1 changed files with 14 additions and 13 deletions
|
@ -25,19 +25,20 @@ public class PinHelper {
|
||||||
String pin, MasterKey masterKey
|
String pin, MasterKey masterKey
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final var backupResponse = secureValueRecoveryV2.setPin(pin, masterKey).execute();
|
final var backupResponse = secureValueRecoveryV2.setPin(pin, masterKey).execute();
|
||||||
switch (backupResponse) {
|
|
||||||
case SecureValueRecovery.BackupResponse.Success success -> {
|
if (backupResponse == SecureValueRecovery.BackupResponse.Success) {
|
||||||
}
|
} else if (backupResponse == SecureValueRecovery.BackupResponse.ServerRejected) {
|
||||||
case SecureValueRecovery.BackupResponse.ServerRejected serverRejected ->
|
|
||||||
logger.warn("Backup svr2 failed: ServerRejected");
|
logger.warn("Backup svr2 failed: ServerRejected");
|
||||||
case SecureValueRecovery.BackupResponse.EnclaveNotFound enclaveNotFound ->
|
} else if (backupResponse == SecureValueRecovery.BackupResponse.EnclaveNotFound) {
|
||||||
logger.warn("Backup svr2 failed: EnclaveNotFound");
|
logger.warn("Backup svr2 failed: EnclaveNotFound");
|
||||||
case SecureValueRecovery.BackupResponse.ExposeFailure exposeFailure ->
|
} else if (backupResponse == SecureValueRecovery.BackupResponse.ExposeFailure) {
|
||||||
logger.warn("Backup svr2 failed: ExposeFailure");
|
logger.warn("Backup svr2 failed: ExposeFailure");
|
||||||
case SecureValueRecovery.BackupResponse.ApplicationError error ->
|
} else if (backupResponse == SecureValueRecovery.BackupResponse.ApplicationError) {
|
||||||
throw new IOException(error.getException());
|
throw new IOException(error.getException());
|
||||||
case SecureValueRecovery.BackupResponse.NetworkError error -> throw error.getException();
|
} else if (backupResponse == SecureValueRecovery.BackupResponse.NetworkError) {
|
||||||
case null, default -> throw new AssertionError("Unexpected response");
|
throw new RuntimeException("network error");
|
||||||
|
} else {
|
||||||
|
throw new AssertionError("Unexpected response");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue