Skip to content

Commit f549467

Browse files
committed
Rename SharedObjectMapper to SharedJsonMapper
Closes gh-47471
1 parent 6e4b88d commit f549467

28 files changed

Lines changed: 77 additions & 76 deletions

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuilderMetadata.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.springframework.boot.buildpack.platform.docker.type.Image;
3232
import org.springframework.boot.buildpack.platform.docker.type.ImageConfig;
3333
import org.springframework.boot.buildpack.platform.json.MappedObject;
34-
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
34+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
3535
import org.springframework.util.Assert;
3636
import org.springframework.util.StringUtils;
3737

@@ -149,7 +149,7 @@ BuilderMetadata copy(Consumer<Update> update) {
149149
*/
150150
void attachTo(ImageConfig.Update update) {
151151
try {
152-
String json = SharedObjectMapper.get().writeValueAsString(getNode());
152+
String json = SharedJsonMapper.get().writeValueAsString(getNode());
153153
update.withLabel(LABEL_NAME, json);
154154
}
155155
catch (JacksonException ex) {
@@ -189,7 +189,7 @@ static BuilderMetadata fromImageConfig(ImageConfig imageConfig) throws IOExcepti
189189
* @throws IOException on IO error
190190
*/
191191
static BuilderMetadata fromJson(String json) throws IOException {
192-
return new BuilderMetadata(SharedObjectMapper.get().readTree(json));
192+
return new BuilderMetadata(SharedJsonMapper.get().readTree(json));
193193
}
194194

195195
/**

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildpackLayersMetadata.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.springframework.boot.buildpack.platform.docker.type.Image;
2828
import org.springframework.boot.buildpack.platform.docker.type.ImageConfig;
2929
import org.springframework.boot.buildpack.platform.json.MappedObject;
30-
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
30+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
3131
import org.springframework.util.Assert;
3232
import org.springframework.util.StringUtils;
3333

@@ -90,7 +90,7 @@ static BuildpackLayersMetadata fromImageConfig(ImageConfig imageConfig) throws I
9090
* @throws IOException on IO error
9191
*/
9292
static BuildpackLayersMetadata fromJson(String json) throws IOException {
93-
return fromJson(SharedObjectMapper.get().readTree(json));
93+
return fromJson(SharedJsonMapper.get().readTree(json));
9494
}
9595

9696
/**

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildpackMetadata.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.springframework.boot.buildpack.platform.docker.type.Image;
2626
import org.springframework.boot.buildpack.platform.docker.type.ImageConfig;
2727
import org.springframework.boot.buildpack.platform.json.MappedObject;
28-
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
28+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
2929
import org.springframework.util.Assert;
3030
import org.springframework.util.StringUtils;
3131

@@ -113,7 +113,7 @@ static BuildpackMetadata fromImageConfig(ImageConfig imageConfig) throws IOExcep
113113
* @throws IOException on IO error
114114
*/
115115
static BuildpackMetadata fromJson(String json) throws IOException {
116-
return fromJson(SharedObjectMapper.get().readTree(json));
116+
return fromJson(SharedJsonMapper.get().readTree(json));
117117
}
118118

119119
/**

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import org.springframework.boot.buildpack.platform.io.IOBiConsumer;
4646
import org.springframework.boot.buildpack.platform.io.TarArchive;
4747
import org.springframework.boot.buildpack.platform.json.JsonStream;
48-
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
48+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
4949
import org.springframework.util.Assert;
5050
import org.springframework.util.StringUtils;
5151

@@ -111,7 +111,7 @@ public DockerApi(@Nullable DockerConnectionConfiguration connectionConfiguration
111111
Assert.notNull(http, "'http' must not be null");
112112
Assert.notNull(log, "'log' must not be null");
113113
this.http = http;
114-
this.jsonStream = new JsonStream(SharedObjectMapper.get());
114+
this.jsonStream = new JsonStream(SharedJsonMapper.get());
115115
this.image = new ImageApi();
116116
this.container = new ContainerApi();
117117
this.volume = new VolumeApi();
@@ -397,7 +397,7 @@ private ContainerReference createContainer(ContainerConfig config, @Nullable Ima
397397
: buildUrl("/containers/create");
398398
try (Response response = http().post(createUri, "application/json", config::writeTo)) {
399399
return ContainerReference
400-
.of(SharedObjectMapper.get().readTree(response.getContent()).at("/Id").asString());
400+
.of(SharedJsonMapper.get().readTree(response.getContent()).at("/Id").asString());
401401
}
402402
}
403403

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/CredentialHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.sun.jna.Platform;
2828
import org.jspecify.annotations.Nullable;
2929

30-
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
30+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
3131

3232
/**
3333
* Invokes a Docker credential helper executable that can be used to get {@link Credential
@@ -59,7 +59,7 @@ class CredentialHelper {
5959
int exitCode = process.waitFor();
6060
try (InputStream response = process.getInputStream()) {
6161
if (exitCode == 0) {
62-
return new Credential(SharedObjectMapper.get().readTree(response));
62+
return new Credential(SharedJsonMapper.get().readTree(response));
6363
}
6464
String errorMessage = new String(response.readAllBytes(), StandardCharsets.UTF_8);
6565
if (!isCredentialsNotFoundError(errorMessage)) {

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/DockerConfigurationMetadata.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import tools.jackson.databind.node.NullNode;
3535

3636
import org.springframework.boot.buildpack.platform.json.MappedObject;
37-
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
37+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
3838
import org.springframework.boot.buildpack.platform.system.Environment;
3939
import org.springframework.util.Assert;
4040
import org.springframework.util.StringUtils;
@@ -202,7 +202,7 @@ Map<String, Auth> getAuths() {
202202
}
203203

204204
static DockerConfig fromJson(String json) {
205-
return new DockerConfig(SharedObjectMapper.get().readTree(json));
205+
return new DockerConfig(SharedJsonMapper.get().readTree(json));
206206
}
207207

208208
static DockerConfig empty() {
@@ -286,7 +286,7 @@ DockerContext withTlsPath(String tlsPath) {
286286
}
287287

288288
static DockerContext fromJson(String json) {
289-
return new DockerContext(SharedObjectMapper.get().readTree(json), null);
289+
return new DockerContext(SharedJsonMapper.get().readTree(json), null);
290290
}
291291

292292
static DockerContext empty() {

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/configuration/JsonEncodedDockerRegistryAuthentication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.jspecify.annotations.Nullable;
2323
import tools.jackson.core.JacksonException;
2424

25-
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
25+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
2626

2727
/**
2828
* {@link DockerRegistryAuthentication} that uses a Base64 encoded auth header value based
@@ -42,7 +42,7 @@ class JsonEncodedDockerRegistryAuthentication implements DockerRegistryAuthentic
4242

4343
protected void createAuthHeader() {
4444
try {
45-
this.authHeader = Base64.getUrlEncoder().encodeToString(SharedObjectMapper.get().writeValueAsBytes(this));
45+
this.authHeader = Base64.getUrlEncoder().encodeToString(SharedJsonMapper.get().writeValueAsBytes(this));
4646
}
4747
catch (JacksonException ex) {
4848
throw new IllegalStateException("Error creating Docker registry authentication header", ex);

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/HttpClientTransport.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
import org.springframework.boot.buildpack.platform.io.Content;
4444
import org.springframework.boot.buildpack.platform.io.IOConsumer;
45-
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
45+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
4646
import org.springframework.util.Assert;
4747
import org.springframework.util.StringUtils;
4848

@@ -195,7 +195,7 @@ protected void beforeExecute(HttpRequest request) {
195195
return null;
196196
}
197197
try {
198-
return SharedObjectMapper.get().readValue(content, Errors.class);
198+
return SharedJsonMapper.get().readValue(content, Errors.class);
199199
}
200200
catch (JacksonException ex) {
201201
return null;
@@ -207,7 +207,7 @@ protected void beforeExecute(HttpRequest request) {
207207
return null;
208208
}
209209
try {
210-
Message message = SharedObjectMapper.get().readValue(content, Message.class);
210+
Message message = SharedJsonMapper.get().readValue(content, Message.class);
211211
return (message.getMessage() != null) ? message : null;
212212
}
213213
catch (JacksonException ex) {

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ContainerConfig.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
import java.util.function.Consumer;
2828

2929
import org.jspecify.annotations.Nullable;
30-
import tools.jackson.databind.ObjectMapper;
30+
import tools.jackson.databind.json.JsonMapper;
3131
import tools.jackson.databind.node.ArrayNode;
3232
import tools.jackson.databind.node.ObjectNode;
3333

34-
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
34+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
3535
import org.springframework.util.Assert;
3636
import org.springframework.util.CollectionUtils;
3737
import org.springframework.util.StreamUtils;
@@ -54,8 +54,8 @@ public class ContainerConfig {
5454
List<String> securityOptions) {
5555
Assert.notNull(image, "'image' must not be null");
5656
Assert.hasText(command, "'command' must not be empty");
57-
ObjectMapper objectMapper = SharedObjectMapper.get();
58-
ObjectNode node = objectMapper.createObjectNode();
57+
JsonMapper jsonMapper = SharedJsonMapper.get();
58+
ObjectNode node = jsonMapper.createObjectNode();
5959
if (StringUtils.hasText(user)) {
6060
node.put("User", user);
6161
}
@@ -77,7 +77,7 @@ public class ContainerConfig {
7777
ArrayNode securityOptsNode = hostConfigNode.putArray("SecurityOpt");
7878
securityOptions.forEach(securityOptsNode::add);
7979
}
80-
this.json = objectMapper.writeValueAsString(node);
80+
this.json = jsonMapper.writeValueAsString(node);
8181
}
8282

8383
/**

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchive.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import org.springframework.boot.buildpack.platform.io.Layout;
4242
import org.springframework.boot.buildpack.platform.io.Owner;
4343
import org.springframework.boot.buildpack.platform.io.TarArchive;
44-
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper;
44+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
4545
import org.springframework.util.Assert;
4646

4747
/**
@@ -273,7 +273,7 @@ private Update(Image image) {
273273
private ImageArchive applyTo(IOConsumer<Update> update) throws IOException {
274274
update.accept(this);
275275
Instant createDate = (this.createDate != null) ? this.createDate : WINDOWS_EPOCH_PLUS_SECOND;
276-
return new ImageArchive(SharedObjectMapper.get(), this.config, createDate, this.tag, this.image.getOs(),
276+
return new ImageArchive(SharedJsonMapper.get(), this.config, createDate, this.tag, this.image.getOs(),
277277
this.image.getArchitecture(), this.image.getVariant(), this.image.getLayers(),
278278
Collections.unmodifiableList(this.newLayers));
279279
}

0 commit comments

Comments
 (0)