Code Fix.
This commit is contained in:
@@ -181,6 +181,7 @@ public class AppointmentDao {
|
||||
int attempt = 0;
|
||||
boolean success = false;
|
||||
while (attempt < maxRetries && !success) {
|
||||
attempt++;
|
||||
try {
|
||||
//code to generate token with payload having "iat" epoch timestamp and secret key with no expiry and send in below method call
|
||||
String authJwtToken = Utils.generateAuthTokenForLoginToOdessa();
|
||||
@@ -244,16 +245,9 @@ public class AppointmentDao {
|
||||
} catch (IOException e) {
|
||||
log.error("Error parsing JSON response: {}", e.getMessage());
|
||||
}
|
||||
if (attempt + 1 < maxRetries) {
|
||||
regenerateTokenAndSave(hub);
|
||||
} else {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale("Maximum retry attempts reached while trying to login to Odessa."));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to authenticate user on Odessa : {}", e.getMessage(), e);
|
||||
throw new RuntimeException("Authentication failed on Odessa. try again", e);
|
||||
} finally {
|
||||
attempt++;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -436,6 +430,7 @@ public class AppointmentDao {
|
||||
int attempt = 0;
|
||||
boolean success = false;
|
||||
while (attempt < maxRetries && !success) {
|
||||
attempt++;
|
||||
try {
|
||||
//code to generate token with payload having "iat" epoch timestamp and secret key with no expiry and send in below method call
|
||||
String authJwtToken = Utils.generateAuthTokenForLoginToOdessa();
|
||||
@@ -501,16 +496,9 @@ public class AppointmentDao {
|
||||
} catch (IOException e) {
|
||||
log.error("Error parsing JSON response: {}", e.getMessage());
|
||||
}
|
||||
if (attempt + 1 < maxRetries) {
|
||||
regenerateTokenAndSave(hub);
|
||||
} else {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale("Maximum retry attempts reached while trying to login to Odessa."));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to authenticate user on Odessa : {}", e.getMessage(), e);
|
||||
throw new RuntimeException("Authentication failed on Odessa. try again", e);
|
||||
} finally {
|
||||
attempt++;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user