commit 1fcd42352f1c78ab6d496dc04cfad0175271c946
parent 43e2ae1fbf78bfbb250a2c76b9a6fa96523816a7
Author: Wim Dupont <wim@wimdupont.com>
Date: Fri, 1 Dec 2023 18:28:05 +0100
java 21 upgrade
Former-commit-id: 225ed52db80078f70bbe2613618a64817983fb8c
Diffstat:
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
@@ -14,7 +14,7 @@
<description>Wim Dupont's personal website</description>
<properties>
- <java.version>17</java.version>
+ <java.version>21</java.version>
<springdoc-openapi.version>2.2.0</springdoc-openapi.version>
<asciidoctorj.version>2.5.10</asciidoctorj.version>
<flyway.configFiles>src/main/resources/application.properties</flyway.configFiles>
diff --git a/src/main/java/com/wimdupont/personalweb/config/SwaggerConfig.java b/src/main/java/com/wimdupont/personalweb/config/SwaggerConfig.java
@@ -4,6 +4,8 @@ import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.servers.Server;
import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@@ -16,6 +18,7 @@ import java.util.List;
@Configuration
public class SwaggerConfig {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SwaggerConfig.class);
private static final String DOCUMENTATION_FILE = "api-documentation.md";
private final String serverUrl;
@@ -42,7 +45,7 @@ public class SwaggerConfig {
info.description(new String(in.readAllBytes()));
}
} catch (IOException e) {
- e.printStackTrace();
+ LOGGER.error(e.getMessage(), e);
}
return info;
}
diff --git a/src/main/java/com/wimdupont/personalweb/model/InszModel.java b/src/main/java/com/wimdupont/personalweb/model/InszModel.java
@@ -22,7 +22,7 @@ public record InszModel(
public InszModel(LocalDate birthDate, Integer birthCounter, Gender gender) {
this.birthDate = generateBirthDateIfNull(birthDate);
- this.birthCounter = getRandomIfNull(birthCounter, 1, 998);
+ this.birthCounter = getRandomIfNull(birthCounter);
this.gender = getRandomIfNull(gender);
}
@@ -32,9 +32,9 @@ public record InszModel(
: gender;
}
- private int getRandomIfNull(Integer value, int min, int max) {
+ private int getRandomIfNull(Integer value) {
return value == null
- ? generateRandom(min, max)
+ ? generateRandom(1, 998)
: value;
}