This is an automated email from the ASF dual-hosted git repository.

ndipiazza pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/main by this push:
     new ab562a35a TIKA-4589: Update ObjectMapper to use Jackson MapperBuilder 
pattern (#2483)
ab562a35a is described below

commit ab562a35a365c7a55f3006c809b575abe20b128d
Author: Nicholas DiPiazza <[email protected]>
AuthorDate: Fri Dec 26 11:05:36 2025 -0600

    TIKA-4589: Update ObjectMapper to use Jackson MapperBuilder pattern (#2483)
    
    - Replace deprecated setDefaultPropertyInclusion() with builder pattern
    - Use JsonMapper.builder().defaultPropertyInclusion()
    - Compatible with Jackson 2.x and forward-compatible with 3.0
    - Removes deprecation warning and TODO comment
---
 .../main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git 
a/tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java 
b/tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java
index 29632929f..c7c3dd9bf 100644
--- a/tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java
+++ b/tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java
@@ -26,6 +26,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
 import com.fasterxml.jackson.module.jsonSchema.JsonSchema;
 import com.fasterxml.jackson.module.jsonSchema.JsonSchemaGenerator;
 import com.google.rpc.Status;
@@ -68,11 +69,9 @@ import org.apache.tika.plugins.TikaPluginManager;
 
 class TikaGrpcServerImpl extends TikaGrpc.TikaImplBase {
     private static final Logger LOG = 
LoggerFactory.getLogger(TikaGrpcServerImpl.class);
-    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
-    static {
-        //TODO with Jackson 3.0 we'll have to use MapperBuilder
-        
OBJECT_MAPPER.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL);
-    }
+    private static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder()
+            
.defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL,
 JsonInclude.Include.NON_NULL))
+            .build();
     public static final JsonSchemaGenerator JSON_SCHEMA_GENERATOR = new 
JsonSchemaGenerator(OBJECT_MAPPER);
 
     PipesConfig pipesConfig;

Reply via email to