[jOOQ/jOOQ#13605] Re-add explicit java.time and kotlin modules

Let's not create a potential security issue by loading all possible modules from the classpath, but load only the ones we know (so far) have been useful in the DefaultConverterProvider
This commit is contained in:
Lukas Eder 2022-05-27 18:11:57 +02:00
parent e55c60d3a7
commit 807bbee00c
3 changed files with 14 additions and 2 deletions

View File

@ -46,6 +46,14 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>

View File

@ -6,6 +6,8 @@ module org.jooq.jackson.extensions {
// Other jOOQ modules
requires transitive org.jooq;
requires com.fasterxml.jackson.databind;
requires com.fasterxml.jackson.datatype.jsr310;
requires com.fasterxml.jackson.kotlin;
// Nullability annotations for better Kotlin interop
requires static org.jetbrains.annotations;

View File

@ -45,6 +45,8 @@ import org.jooq.impl.AbstractConverter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.kotlin.KotlinModule;
/**
* A base class for {@link JSON} or {@link JSONB} to Jackson POJO conversion.
@ -60,12 +62,12 @@ abstract class AbstractToJacksonConverter<J, U> extends AbstractConverter<J, U>
mapper = JsonMapper
.builder()
.findAndAddModules()
.addModule(new JavaTimeModule())
.addModule(new KotlinModule())
.build();
}
abstract String data(J json);
abstract J json(String string);
@Override