From 09d1088a8b6c09c1771ceb14f74962fb240beaa6 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 11 Aug 2022 15:03:51 +0000 Subject: [PATCH] [Admin tools | Trunk]: BrowserCacheController.java: Commented catch of exceptions to print error stacktraces | [Bug fix] Response is HTML, so added String.class instead of Object.class. --- .../controllers/BrowserCacheController.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/eu/dnetlib/uoaadmintools/controllers/BrowserCacheController.java b/src/main/java/eu/dnetlib/uoaadmintools/controllers/BrowserCacheController.java index dc620ed..6b78e6f 100644 --- a/src/main/java/eu/dnetlib/uoaadmintools/controllers/BrowserCacheController.java +++ b/src/main/java/eu/dnetlib/uoaadmintools/controllers/BrowserCacheController.java @@ -3,7 +3,6 @@ package eu.dnetlib.uoaadmintools.controllers; import eu.dnetlib.uoaadmintools.configuration.properties.BrowserCacheConfig; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import org.springframework.web.client.HttpClientErrorException; @@ -27,15 +26,18 @@ public class BrowserCacheController { "@AuthorizationService.curator('community'), @AuthorizationService.manager('community', #pid))") @RequestMapping(value = "/{pid}", method = RequestMethod.GET) public boolean purge(@PathVariable(value = "pid") String pid) { - try { - ResponseEntity responseEntity = restTemplate.getForEntity(config.getUrl().replace("{community}", pid), Object.class); - } catch(HttpClientErrorException httpClientErrorException) { - log.debug("Purge browser cache: HttpClientErrorException for "+pid + " - code: " + httpClientErrorException.getStatusCode()); - } catch(ResourceAccessException resourceAccessException) { - log.debug("Purge browser cache: ResourceAccessException for "+pid); - } catch(Exception exception) { - log.debug("Purge browser cache: " + exception.getClass() + " for "+pid); - } +// try { + restTemplate.getForEntity(config.getUrl().replace("{community}", pid), String.class); +// } catch(HttpClientErrorException httpClientErrorException) { +// log.debug("Purge browser cache: HttpClientErrorException for "+pid + " - code: " + httpClientErrorException.getStatusCode()); +// return false; +// } catch(ResourceAccessException resourceAccessException) { +// log.debug("Purge browser cache: ResourceAccessException for "+pid); +// return false; +// } catch(Exception exception) { +// log.debug("Purge browser cache: " + exception.getClass() + " for "+pid); +// return false; +// } return true; } }