Skip to content

Commit e89bb1f

Browse files
committed
Merge branch '3.5.x'
Closes gh-48109
2 parents d1e5fe3 + b543ab8 commit e89bb1f

File tree

1 file changed

+7
-9
lines changed
  • buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker

1 file changed

+7
-9
lines changed

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
import java.util.Objects;
2020

2121
import org.jspecify.annotations.Nullable;
22+
import tools.jackson.databind.node.ObjectNode;
2223

2324
import org.springframework.boot.buildpack.platform.docker.type.Image;
25+
import org.springframework.boot.buildpack.platform.json.SharedJsonMapper;
2426
import org.springframework.util.Assert;
2527
import org.springframework.util.StringUtils;
2628

@@ -108,19 +110,15 @@ public static ImagePlatform from(Image image) {
108110
* @return the JSON string
109111
*/
110112
public String toJson() {
111-
StringBuilder json = new StringBuilder("{");
112-
json.append(jsonPair("os", this.os));
113+
ObjectNode json = SharedJsonMapper.get().createObjectNode();
114+
json.put("os", this.os);
113115
if (StringUtils.hasText(this.architecture)) {
114-
json.append(",").append(jsonPair("architecture", this.architecture));
116+
json.put("architecture", this.architecture);
115117
}
116118
if (StringUtils.hasText(this.variant)) {
117-
json.append(",").append(jsonPair("variant", this.variant));
119+
json.put("variant", this.variant);
118120
}
119-
return json.append("}").toString();
120-
}
121-
122-
private String jsonPair(String name, String value) {
123-
return "\"%s\":\"%s\"".formatted(name, value);
121+
return json.toString();
124122
}
125123

126124
}

0 commit comments

Comments
 (0)