Skip to content

Commit

Permalink
Bump jackson.version from 2.17.2 to 2.18.0 (#1036)
Browse files Browse the repository at this point in the history
* Bump jackson.version from 2.17.2 to 2.18.0

Bumps `jackson.version` from 2.17.2 to 2.18.0.

Updates `com.fasterxml.jackson.core:jackson-core` from 2.17.2 to 2.18.0
- [Commits](FasterXML/jackson-core@jackson-core-2.17.2...jackson-core-2.18.0)

Updates `com.fasterxml.jackson.core:jackson-databind` from 2.17.2 to 2.18.0
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `com.fasterxml.jackson.datatype:jackson-datatype-jdk8` from 2.17.2 to 2.18.0

Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-xml` from 2.17.2 to 2.18.0
- [Commits](FasterXML/jackson-dataformat-xml@jackson-dataformat-xml-2.17.2...jackson-dataformat-xml-2.18.0)

Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-csv` from 2.17.2 to 2.18.0
- [Commits](FasterXML/jackson-dataformats-text@jackson-dataformats-text-2.17.2...jackson-dataformats-text-2.18.0)

Updates `com.fasterxml.jackson.datatype:jackson-datatype-jsr310` from 2.17.2 to 2.18.0

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-jdk8
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-xml
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-csv
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-jsr310
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix JsonAnySetter

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mike Barry <[email protected]>
  • Loading branch information
dependabot[bot] and msbarry authored Sep 28, 2024
1 parent 169627d commit ec6b09a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.util.TreeMap;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Metadata associated with a tile archive.
Expand Down Expand Up @@ -49,6 +47,7 @@ public record TileArchiveMetadata(
@JsonSerialize(using = TileArchiveMetadataDeSer.MetadataJsonSerializer.class)
@JsonDeserialize(using = TileArchiveMetadataDeSer.MetadataJsonDeserializer.class) TileArchiveMetadataJson json,
@JsonAnyGetter
@JsonAnySetter
@JsonDeserialize(using = TileArchiveMetadataDeSer.EmptyMapIfNullDeserializer.class) Map<String, String> others,
@JsonProperty(COMPRESSION_KEY) TileCompression tileCompression
) {
Expand All @@ -71,8 +70,6 @@ public record TileArchiveMetadata(

public static final String MVT_FORMAT = "pbf";

private static final Logger LOGGER = LoggerFactory.getLogger(TileArchiveMetadata.class);

public TileArchiveMetadata(Profile profile, PlanetilerConfig config) {
this(profile, config, null);
}
Expand All @@ -94,7 +91,7 @@ public TileArchiveMetadata(Profile profile, PlanetilerConfig config, List<LayerA
config.minzoom(),
config.maxzoom(),
vectorLayers == null ? null : new TileArchiveMetadataJson(vectorLayers),
mergeMaps(mapWithBuildInfo(),profile.extraArchiveMetadata()),
mergeMaps(mapWithBuildInfo(), profile.extraArchiveMetadata()),
config.tileCompression()
);
}
Expand Down Expand Up @@ -170,23 +167,12 @@ public TileArchiveMetadata withJson(TileArchiveMetadataJson json) {
maxzoom, json, others, tileCompression);
}

/*
* few workarounds to make collect unknown fields to others work,
* because @JsonAnySetter does not yet work on constructor/creator arguments
* https://github.com/FasterXML/jackson-databind/issues/3439
*/

private static Map<String,String> mergeMaps(Map<String,String> m1, Map<String,String> m2) {
private static Map<String, String> mergeMaps(Map<String, String> m1, Map<String, String> m2) {
var result = new TreeMap<>(m1);
result.putAll(m2);
return result;
}

@JsonAnySetter
private void putUnknownFieldsToOthers(String name, String value) {
others.put(name, value);
}


public record TileArchiveMetadataJson(
@JsonProperty(VECTOR_LAYERS_KEY) List<LayerAttrStats.VectorLayer> vectorLayers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,19 +363,14 @@ public static List<Entry> directoryFromBytes(byte[] bytes) {
*/
public record JsonMetadata(
@JsonProperty("vector_layers") List<LayerAttrStats.VectorLayer> vectorLayers,
@JsonAnyGetter Map<String, String> otherMetadata
@JsonAnySetter @JsonAnyGetter Map<String, String> otherMetadata
) {

@JsonCreator
public JsonMetadata(@JsonProperty("vector_layers") List<LayerAttrStats.VectorLayer> vectorLayers) {
this(vectorLayers, new HashMap<>());
}

@JsonAnySetter
private void setExtraMetadata(String key, String val) {
otherMetadata.put(key, val);
}

public byte[] toBytes() {

try {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.source.excludeResources>true</maven.source.excludeResources>
<jackson.version>2.17.2</jackson.version>
<jackson.version>2.18.0</jackson.version>
<junit.version>5.11.1</junit.version>
<jts.version>1.20.0</jts.version>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
Expand Down

0 comments on commit ec6b09a

Please sign in to comment.