/Added logs by Francesco M.

This commit is contained in:
Francesco Mangiacrapa 2023-12-13 16:53:02 +01:00
parent db9efda5ca
commit 0a6819cace
1 changed files with 23 additions and 0 deletions

View File

@ -223,6 +223,8 @@ public class Zenodo {
}
private ZenodoDeposition updateMetadata(Integer depositionId,DepositionMetadata meta) throws ZenodoException {
/*
* Original
try{
String serialized="{\"metadata\":"+Fixer.fixIncoming(mapper.writeValueAsString(meta))+"}";
try {
@ -235,6 +237,27 @@ public class Zenodo {
log.debug("Error while tryin to update "+serialized);
throw t;
}
}catch(JsonProcessingException e) {
log.debug("Error while parsing "+meta,e);
throw new ZenodoException("Internal error.",e);
}*/
//Added logs by Francesco M.
try{
String serialized="{\"metadata\":"+Fixer.fixIncoming(mapper.writeValueAsString(meta))+"}";
log.debug("updateMetadata - serialized: {}",serialized);
try {
Entity<String> jsonEnt = Entity.json(serialized);
log.debug("updateMetadata - jsonEntity serialized: {}",jsonEnt.getEntity());
Response resp = getWebClient().target(credentials.getBaseUrl()).
path(DEPOSITION_BASE_URL).path(depositionId+"").
queryParam(ACCESS_TOKEN, credentials.getKey()).request(CONTENT_TYPE)
.put(jsonEnt);
return check(resp,ZenodoDeposition.class);
}catch(Throwable t) {
log.debug("Error while tryin to update "+serialized);
throw t;
}
}catch(JsonProcessingException e) {
log.debug("Error while parsing "+meta,e);
throw new ZenodoException("Internal error.",e);