Skip to content

Commit

Permalink
Prevent deadlock in Jackson (apache#10379)
Browse files Browse the repository at this point in the history
Following warning is always printed when using Iceberg REST clients:
```
PropertyNamingStrategy.KebabCaseStrategy is used but it has been deprecated due to risk of deadlock. Consider using PropertyNamingStrategies.KebabCaseStrategy instead. See FasterXML/jackson-databind#2715 for more details.
```
  • Loading branch information
snazy authored and Sasank Pagolu committed Oct 27, 2024
1 parent c1f6d26 commit 0f0d347
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import java.io.IOException;
Expand Down Expand Up @@ -57,7 +57,7 @@ static ObjectMapper mapper() {
// even though using new PropertyNamingStrategy.KebabCaseStrategy() is deprecated
// and PropertyNamingStrategies.KebabCaseStrategy.INSTANCE (introduced in jackson 2.14) is
// recommended, we can't use it because Spark still relies on jackson 2.13.x stuff
MAPPER.setPropertyNamingStrategy(new PropertyNamingStrategy.KebabCaseStrategy());
MAPPER.setPropertyNamingStrategy(new PropertyNamingStrategies.KebabCaseStrategy());
MAPPER.registerModule(initModule());
isInitialized = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;

class RESTObjectMapper {
private static final JsonFactory FACTORY = new JsonFactory();
Expand All @@ -38,7 +38,7 @@ static ObjectMapper mapper() {
if (!isInitialized) {
MAPPER.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
MAPPER.setPropertyNamingStrategy(new PropertyNamingStrategy.KebabCaseStrategy());
MAPPER.setPropertyNamingStrategy(new PropertyNamingStrategies.KebabCaseStrategy());
RESTSerializers.registerAll(MAPPER);
isInitialized = true;
}
Expand Down

0 comments on commit 0f0d347

Please sign in to comment.