Empty response check

This commit is contained in:
Fabio Sinibaldi 2022-11-14 12:26:35 +01:00
parent d70fe5c9db
commit 87703c97c5
1 changed files with 8 additions and 4 deletions

View File

@ -116,6 +116,8 @@ public class OAIClient {
}
log.trace("Calling {} ",target.getUri());
Response resp=target.request("application/xml").get();
@ -127,11 +129,13 @@ public class OAIClient {
//No errors, thus reset attempt counter
currentAttempt=1;
toReturn.addAll(msg.getResponseRecords().getRecords());
if(msg.getResponseRecords().getRecords()!=null)
toReturn.addAll(msg.getResponseRecords().getRecords());
else log.info("NB {} didn't returned any record",msg.getRequest().getPath());
log.debug("Parsed "+toReturn.size()+" records so far.");
Token t=msg.getResponseRecords().getResumptionToken();
Token t=msg.getResponseRecords().getResumptionToken();
log.debug("Obtained token : "+t);
if(t!=null && t.getId()!=null && !t.getId().isEmpty()) {
@ -144,7 +148,7 @@ public class OAIClient {
isComplete=true;
}
}catch(Throwable t) {
log.warn("Unexpected ERROR "+t.getMessage());
log.warn("Unexpected ERROR ",t);
log.debug("Current attempt number = "+currentAttempt," max attempt Number = "+MAX_ATTEMPTS+", attempts delay factor = ");
isComplete=currentAttempt>MAX_ATTEMPTS;
try {