[ 
https://issues.apache.org/jira/browse/TIKA-4589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18047672#comment-18047672
 ] 

ASF GitHub Bot commented on TIKA-4589:
--------------------------------------

nddipiazza opened a new pull request, #2483:
URL: https://github.com/apache/tika/pull/2483

   ## Problem
   
   The `TikaGrpcServerImpl` uses `ObjectMapper.setDefaultPropertyInclusion()` 
which is deprecated and will be removed in Jackson 3.0.
   
   ## Solution
   
   Updated to use the `JsonMapper.builder()` pattern which is:
   - Compatible with Jackson 2.x (current version 2.20.1)
   - Forward-compatible with Jackson 3.0
   - Removes deprecation warning
   
   **Changes:**
   ```java
   // Before (deprecated):
   private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
   static {
       OBJECT_MAPPER.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL);
   }
   
   // After (Jackson 3.0 ready):
   private static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder()
           
.defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL,
 JsonInclude.Include.NON_NULL))
           .build();
   ```
   
   ## Testing
   
   - ✅ `mvn clean compile` succeeds without warnings
   - ✅ No deprecation warnings
   - ✅ Behavior remains unchanged (non-null property inclusion)
   
   Fixes: [TIKA-4589](https://issues.apache.org/jira/browse/TIKA-4589)




> Update TikaGrpcServerImpl to use Jackson 3.0 MapperBuilder pattern
> ------------------------------------------------------------------
>
>                 Key: TIKA-4589
>                 URL: https://issues.apache.org/jira/browse/TIKA-4589
>             Project: Tika
>          Issue Type: Task
>            Reporter: Nicholas DiPiazza
>            Priority: Minor
>              Labels: jackson, tika-grpc, upgrade
>
> The TikaGrpcServerImpl uses {{ObjectMapper.setDefaultPropertyInclusion()}} 
> which is deprecated and will be removed in Jackson 3.0.
> *Location:*
> {{tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java:75-76}}
> *Current Code:*
> {code:java}
> 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);
> }
> {code}
> *Required Change:*
> Update to use {{JsonMapper.builder()}} pattern instead:
> {code:java}
> private static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder()
>     .serializationInclusion(JsonInclude.Include.NON_NULL)
>     .build();
> {code}
> *References:*
> - Jackson 3.0 Migration Guide: 
> https://github.com/FasterXML/jackson/wiki/Jackson-Release-3.0
> - The {{setDefaultPropertyInclusion()}} method is marked as deprecated for 
> removal
> *Scope:*
> - Update ObjectMapper initialization in TikaGrpcServerImpl
> - Ensure compatibility with both Jackson 2.x and 3.0 if needed
> - Test JSON serialization behavior remains unchanged



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to