From 86db70caf4be053f0d85eb61d5dde6297aafc207 Mon Sep 17 00:00:00 2001 From: vladp Date: Fri, 20 Mar 2026 18:36:54 +0700 Subject: [PATCH] dev add violation notion --- .../service/search/SearchImageService.java | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/main/java/ru/soune/nocopy/service/search/SearchImageService.java b/src/main/java/ru/soune/nocopy/service/search/SearchImageService.java index dcd79a7..4fd3ea5 100644 --- a/src/main/java/ru/soune/nocopy/service/search/SearchImageService.java +++ b/src/main/java/ru/soune/nocopy/service/search/SearchImageService.java @@ -134,54 +134,54 @@ public class SearchImageService { long start = System.currentTimeMillis(); -// try (Response response = client.newCall(request).execute()) { + try (Response response = client.newCall(request).execute()) { + ResponseBody body = response.body(); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); + log.info("Search reverse response body: {}", body); // long duration = System.currentTimeMillis() - start; // log.info("SearchAPI response code={}, duration={}ms, engine={}", // response.code(), duration, engine); -// + // if (!response.isSuccessful()) { // String errorBody = response.body() != null ? response.body().string() : "null"; // throw new IOException("API error " + response.code() + ": " + errorBody); // } -// + // ResponseBody body = response.body(); -// if (body == null) { -// throw new IOException("Empty response body"); -// } -// -// return body.string(); -// } - - try (Response response = client.newCall(request).execute()) { - long duration = System.currentTimeMillis() - start; - log.info("SearchAPI response code={}, duration={}ms, engine={}", - response.code(), duration, engine); - - ResponseBody body = response.body(); if (body == null) { throw new IOException("Empty response body"); } - String responseBody = readWithTimeout(body, 30000); - - log.info("Read {} bytes (may be partial)", responseBody.length()); - - if (responseBody.length() > 0) { - String preview = responseBody.length() > 500 ? - responseBody.substring(0, 500) + "..." : responseBody; - log.info("Response preview: {}", preview); - } - - if (!response.isSuccessful()) { - throw new IOException("API error " + response.code() + ": " + - (responseBody.length() > 200 ? responseBody.substring(0, 200) : responseBody)); - } - - return responseBody; - - } catch (InterruptedIOException e) { - log.error("Timeout during reading, partial data may be lost"); - throw e; + return body.string(); } }