From 20911982a608c52bffbbbb70a1fe5e26478fd6cd Mon Sep 17 00:00:00 2001 From: backdev-1 Date: Tue, 19 May 2026 13:08:55 +0700 Subject: [PATCH] dev check violation for lawcase,complaint --- .../ru/soune/nocopy/handler/ViolationHandler.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/soune/nocopy/handler/ViolationHandler.java b/src/main/java/ru/soune/nocopy/handler/ViolationHandler.java index 00ed8fd..19c845b 100644 --- a/src/main/java/ru/soune/nocopy/handler/ViolationHandler.java +++ b/src/main/java/ru/soune/nocopy/handler/ViolationHandler.java @@ -176,10 +176,20 @@ public class ViolationHandler implements RequestHandler { for (Violation violation : content) { if (firstShowViolation != null && Objects.equals(firstShowViolation.getId(), violation.getId())) continue; + String country; + String countryCode; ViolationResponse.ViolationDto violationDto = ViolationResponse.ViolationDto.fromEntity(violation); - violationDto.setCountry(geoCountryService.getCountryName(violation.getPageUrl())); - violationDto.setCountryCode(geoCountryService.getCountryCode(violation.getPageUrl())); + try { + country = geoCountryService.getCountryName(violation.getHost()); + countryCode = geoCountryService.getCountryCode(violation.getHost()); + } catch (Exception e) { + country = geoCountryService.getCountryName(violation.getUrl()); + countryCode = geoCountryService.getCountryCode(violation.getUrl()); + } + + violationDto.setCountry(country); + violationDto.setCountryCode(countryCode); violationDtos.add(violationDto); }