fix_26166 #6

Merged
francesco.mangiacrapa merged 5 commits from fix_26166 into master 2023-12-21 09:00:36 +01:00
1 changed files with 23 additions and 0 deletions
Showing only changes of commit 0a6819cace - Show all commits

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);