Skip to content

Commit

Permalink
Prevent deadlock in Jackson
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 committed May 25, 2024
1 parent 311dbbb commit a5225ef
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 a5225ef

Please sign in to comment.