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