Skip to content

Commit 6304f3a

Browse files
authored
GH-5744: migrate RDF4J to Jackson 3 LTS (#5773)
2 parents 5106fa7 + 1319410 commit 6304f3a

45 files changed

Lines changed: 794 additions & 638 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/http/client/src/main/java/org/eclipse/rdf4j/http/client/RDF4JProtocolSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
import org.slf4j.Logger;
8585
import org.slf4j.LoggerFactory;
8686

87-
import com.fasterxml.jackson.databind.ObjectMapper;
87+
import tools.jackson.databind.ObjectMapper;
8888

8989
/**
9090
* A {@link SPARQLProtocolSession} subclass which extends the standard SPARQL 1.1 Protocol with additional

core/query/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@
2525
<artifactId>jackson-annotations</artifactId>
2626
</dependency>
2727
<dependency>
28-
<groupId>com.fasterxml.jackson.core</groupId>
28+
<groupId>tools.jackson.core</groupId>
2929
<artifactId>jackson-core</artifactId>
30+
<version>${jackson3.version}</version>
3031
</dependency>
3132
<dependency>
32-
<groupId>com.fasterxml.jackson.core</groupId>
33+
<groupId>tools.jackson.core</groupId>
3334
<artifactId>jackson-databind</artifactId>
35+
<version>${jackson3.version}</version>
3436
</dependency>
3537
<dependency>
3638
<groupId>org.apache.commons</groupId>

core/query/src/main/java/org/eclipse/rdf4j/query/explanation/ExplanationImpl.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
import com.fasterxml.jackson.annotation.JsonAutoDetect;
1616
import com.fasterxml.jackson.annotation.JsonInclude;
1717
import com.fasterxml.jackson.annotation.PropertyAccessor;
18-
import com.fasterxml.jackson.core.JsonProcessingException;
19-
import com.fasterxml.jackson.databind.ObjectMapper;
18+
19+
import tools.jackson.databind.ObjectMapper;
20+
import tools.jackson.databind.json.JsonMapper;
2021

2122
/**
2223
* This is an experimental feature. It may be changed, moved or potentially removed in a future release.
@@ -37,7 +38,12 @@ public ExplanationImpl(GenericPlanNode genericPlanNode, boolean timedOut, Object
3738
}
3839
}
3940

40-
ObjectMapper objectMapper = new ObjectMapper();
41+
ObjectMapper objectMapper = JsonMapper.builder()
42+
.changeDefaultVisibility(vc -> vc
43+
.withVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.PUBLIC_ONLY)
44+
.withVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.NONE))
45+
.changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(JsonInclude.Include.NON_NULL))
46+
.build();
4147

4248
@Override
4349
public Object tupleExpr() {
@@ -51,16 +57,10 @@ public GenericPlanNode toGenericPlanNode() {
5157

5258
@Override
5359
public String toJson() {
54-
try {
55-
// TODO: Consider removing pretty printer
56-
return this.objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.PUBLIC_ONLY)
57-
.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.NONE)
58-
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
59-
.writerWithDefaultPrettyPrinter()
60-
.writeValueAsString(toGenericPlanNode());
61-
} catch (JsonProcessingException e) {
62-
throw new RuntimeException(e);
63-
}
60+
// TODO: Consider removing pretty printer
61+
return this.objectMapper
62+
.writerWithDefaultPrettyPrinter()
63+
.writeValueAsString(toGenericPlanNode());
6464
}
6565

6666
@Override

core/queryresultio/sparqljson/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
<version>${project.version}</version>
2727
</dependency>
2828
<dependency>
29-
<groupId>com.fasterxml.jackson.core</groupId>
29+
<groupId>tools.jackson.core</groupId>
3030
<artifactId>jackson-core</artifactId>
31+
<version>${jackson3.version}</version>
3132
</dependency>
3233
<dependency>
3334
<groupId>${project.groupId}</groupId>

0 commit comments

Comments
 (0)