This commit is contained in:
@@ -176,10 +176,20 @@ public class ViolationHandler implements RequestHandler {
|
|||||||
|
|
||||||
for (Violation violation : content) {
|
for (Violation violation : content) {
|
||||||
if (firstShowViolation != null && Objects.equals(firstShowViolation.getId(), violation.getId())) continue;
|
if (firstShowViolation != null && Objects.equals(firstShowViolation.getId(), violation.getId())) continue;
|
||||||
|
String country;
|
||||||
|
String countryCode;
|
||||||
|
|
||||||
ViolationResponse.ViolationDto violationDto = ViolationResponse.ViolationDto.fromEntity(violation);
|
ViolationResponse.ViolationDto violationDto = ViolationResponse.ViolationDto.fromEntity(violation);
|
||||||
violationDto.setCountry(geoCountryService.getCountryName(violation.getPageUrl()));
|
try {
|
||||||
violationDto.setCountryCode(geoCountryService.getCountryCode(violation.getPageUrl()));
|
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);
|
violationDtos.add(violationDto);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user