From e8efacb19341193c4241268e7bd450a442149b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6berl?= Date: Mon, 9 Sep 2024 07:53:17 +0200 Subject: [PATCH] switch to new Spring API after update --- CHANGELOG.md | 12 +++++++++++- .../weblate/spring/WeblateMessageSource.java | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 117c8dc..ea24b8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.0] - (https://github.com/porscheinformatik/weblate-spring/compare/v0.8.0...v0.9.0) - unreleased + +### BREAKING CHANGES + +- Java 17 and Spring Boot 3.x is now required + +### Dependencies + +- Spring Boot 3 (#82) + ## [0.8.0] - (https://github.com/porscheinformatik/weblate-spring/compare/v0.7.1...v0.8.0) - 2023-01-14 ### BREAKING CHANGES @@ -72,7 +82,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Spring Boot 2.6.5 -## [0.3.1](https://github.com/porscheinformatik/weblate-spring/compare/v0.3.0...v0.3.1) - 2021-11-29 +## [0.3.1](https://github.com/porscheinformatik/weblate-spring/compare/v0.3.0...v0.3.1) - 2021-11-29 ### Bug Fixes diff --git a/src/main/java/at/porscheinformatik/weblate/spring/WeblateMessageSource.java b/src/main/java/at/porscheinformatik/weblate/spring/WeblateMessageSource.java index 46f77d2..cc52744 100644 --- a/src/main/java/at/porscheinformatik/weblate/spring/WeblateMessageSource.java +++ b/src/main/java/at/porscheinformatik/weblate/spring/WeblateMessageSource.java @@ -414,7 +414,7 @@ private void loadTranslation(String code, Properties properties, long timestamp) ResponseEntity response = restTemplate.exchange(request, UnitsResponse.class); UnitsResponse body = response.getBody(); - if (response.getStatusCodeValue() < 200 || response.getStatusCodeValue() >= 300 || body == null) { + if (response.getStatusCode().is2xxSuccessful() || body == null) { logger.warn(String.format("Got empty or non-200 response (status=%s, body=%s)", response.getStatusCode(), response.getBody())); break; @@ -447,7 +447,7 @@ private Map loadCodes() { ResponseEntity>> response = restTemplate.exchange(request, LIST_MAP_STRING_OBJECT); List> body = response.getBody(); - if (response.getStatusCodeValue() >= 200 && response.getStatusCodeValue() < 300 && body != null) { + if (response.getStatusCode().is2xxSuccessful() && body != null) { existingLocales = body.stream() .filter(this::containsTranslations) .map(this::extractCode)