From a39821ff354c9ae5714966e8232844af567560d3 Mon Sep 17 00:00:00 2001 From: Christoph Lorenz Date: Wed, 8 Jan 2025 16:20:34 +0100 Subject: [PATCH] Fixed 404 handling on deletions --- CHANGELOG.md | 4 ++++ metasvc-client/pom.xml | 2 +- .../java/de/digitalcollections/client/BaseRestClient.java | 7 ++++--- metasvc-lobid-client/pom.xml | 2 +- metasvc-model/pom.xml | 2 +- metasvc-server/backend-api/pom.xml | 2 +- metasvc-server/backend-file/pom.xml | 2 +- metasvc-server/backend-inmemory/pom.xml | 2 +- metasvc-server/backend-jdbi/pom.xml | 2 +- metasvc-server/backend-lobid/pom.xml | 2 +- metasvc-server/business/pom.xml | 2 +- metasvc-server/pom.xml | 2 +- metasvc-server/webapp/pom.xml | 2 +- pom.xml | 2 +- 14 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 733458dc0..de8518d97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## Unreleased +### Fixed + +- A deletion of a nonexistant resource no longer leads to a client error + ## [9.4.0](https://github.com/dbmdz/metadata-service/releases/tag/9.4.0) - 2024-12-06 ### Added diff --git a/metasvc-client/pom.xml b/metasvc-client/pom.xml index 5899c5f19..8232b25dd 100644 --- a/metasvc-client/pom.xml +++ b/metasvc-client/pom.xml @@ -6,7 +6,7 @@ io.github.dbmdz.metadata metasvc - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: Repository Client diff --git a/metasvc-client/src/main/java/de/digitalcollections/client/BaseRestClient.java b/metasvc-client/src/main/java/de/digitalcollections/client/BaseRestClient.java index 67f2d1e4d..786e1cb69 100644 --- a/metasvc-client/src/main/java/de/digitalcollections/client/BaseRestClient.java +++ b/metasvc-client/src/main/java/de/digitalcollections/client/BaseRestClient.java @@ -191,13 +191,14 @@ private HttpRequest createPutRequest(String requestUrl, Object bodyObject) protected String doDeleteRequestForString(String requestUrl) throws TechnicalException { HttpRequest req = createDeleteRequest(requestUrl); try { - HttpResponse response = http.send(req, HttpResponse.BodyHandlers.ofString()); + HttpResponse response = http.send(req, HttpResponse.BodyHandlers.ofByteArray()); Integer statusCode = response.statusCode(); if (statusCode >= 400) { throw HttpErrorDecoder.decode("DELETE " + requestUrl, statusCode, response); } - String body = response.body(); - if (body == null || body.isBlank()) { + // This is the most performant approach for Jackson + final byte[] body = response.body(); + if (body == null || body.length == 0) { return null; } String result = mapper.readerFor(String.class).readValue(body); diff --git a/metasvc-lobid-client/pom.xml b/metasvc-lobid-client/pom.xml index 03d6daa2e..773423279 100644 --- a/metasvc-lobid-client/pom.xml +++ b/metasvc-lobid-client/pom.xml @@ -7,7 +7,7 @@ io.github.dbmdz.metadata metasvc - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: lobid.org Client diff --git a/metasvc-model/pom.xml b/metasvc-model/pom.xml index 3dd55a2ed..6e2d81d4f 100644 --- a/metasvc-model/pom.xml +++ b/metasvc-model/pom.xml @@ -6,7 +6,7 @@ io.github.dbmdz.metadata metasvc - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: Model diff --git a/metasvc-server/backend-api/pom.xml b/metasvc-server/backend-api/pom.xml index d698dca02..734c8fe67 100644 --- a/metasvc-server/backend-api/pom.xml +++ b/metasvc-server/backend-api/pom.xml @@ -6,7 +6,7 @@ io.github.dbmdz.metadata metasvc-server - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: Repository Server (Backend API) diff --git a/metasvc-server/backend-file/pom.xml b/metasvc-server/backend-file/pom.xml index 321bc08ba..d1dde616a 100644 --- a/metasvc-server/backend-file/pom.xml +++ b/metasvc-server/backend-file/pom.xml @@ -5,7 +5,7 @@ io.github.dbmdz.metadata metasvc-server - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: Repository Server (Backend IMPL File) diff --git a/metasvc-server/backend-inmemory/pom.xml b/metasvc-server/backend-inmemory/pom.xml index d493291a9..7dbb4f3c4 100644 --- a/metasvc-server/backend-inmemory/pom.xml +++ b/metasvc-server/backend-inmemory/pom.xml @@ -6,7 +6,7 @@ io.github.dbmdz.metadata metasvc-server - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: Repository Server (Backend IMPL InMemory) diff --git a/metasvc-server/backend-jdbi/pom.xml b/metasvc-server/backend-jdbi/pom.xml index 770523a6c..42259c334 100644 --- a/metasvc-server/backend-jdbi/pom.xml +++ b/metasvc-server/backend-jdbi/pom.xml @@ -8,7 +8,7 @@ io.github.dbmdz.metadata metasvc-server - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: Repository Server (Backend IMPL JDBI PostgreSql) diff --git a/metasvc-server/backend-lobid/pom.xml b/metasvc-server/backend-lobid/pom.xml index e9e0cf99b..87e102205 100644 --- a/metasvc-server/backend-lobid/pom.xml +++ b/metasvc-server/backend-lobid/pom.xml @@ -6,7 +6,7 @@ io.github.dbmdz.metadata metasvc-server - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: Repository Server (Backend IMPL External System lobid.org) diff --git a/metasvc-server/business/pom.xml b/metasvc-server/business/pom.xml index 152a90935..fd29a5e41 100644 --- a/metasvc-server/business/pom.xml +++ b/metasvc-server/business/pom.xml @@ -6,7 +6,7 @@ io.github.dbmdz.metadata metasvc-server - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: Repository Server (Business) diff --git a/metasvc-server/pom.xml b/metasvc-server/pom.xml index 34cc4e1e3..ef4cfc77d 100644 --- a/metasvc-server/pom.xml +++ b/metasvc-server/pom.xml @@ -6,7 +6,7 @@ io.github.dbmdz.metadata metasvc - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: Repository Server diff --git a/metasvc-server/webapp/pom.xml b/metasvc-server/webapp/pom.xml index 4e6f548b6..a7b9d4f5f 100644 --- a/metasvc-server/webapp/pom.xml +++ b/metasvc-server/webapp/pom.xml @@ -6,7 +6,7 @@ io.github.dbmdz.metadata metasvc-server - 9.4.0 + 9.4.1-SNAPSHOT Metadata-Service: Repository Server (Webapp) diff --git a/pom.xml b/pom.xml index a803b8682..cfd726643 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ io.github.dbmdz.metadata metasvc - 9.4.0 + 9.4.1-SNAPSHOT pom Metadata-Service