Skip to content

Commit e9c4a5d

Browse files
committed
Polish
1 parent 54e294c commit e9c4a5d

File tree

3 files changed

+12
-20
lines changed
  • spring-boot-project
    • spring-boot-actuator/src/main/java/org/springframework/boot/actuate/mail
    • spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/r2dbc
    • spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker

3 files changed

+12
-20
lines changed

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/mail/MailHealthIndicator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public MailHealthIndicator(JavaMailSenderImpl mailSender) {
3939
@Override
4040
protected void doHealthCheck(Builder builder) throws Exception {
4141
int port = this.mailSender.getPort();
42-
builder.withDetail("location", (port == JavaMailSenderImpl.DEFAULT_PORT) ? this.mailSender.getHost()
43-
: this.mailSender.getHost() + ":" + this.mailSender.getPort());
42+
builder.withDetail("location", (port != JavaMailSenderImpl.DEFAULT_PORT)
43+
? this.mailSender.getHost() + ":" + this.mailSender.getPort() : this.mailSender.getHost());
4444
this.mailSender.testConnection();
4545
builder.up();
4646
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/r2dbc/R2dbcProperties.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ public static class Pool {
138138

139139
/**
140140
* Minimal number of idle connections.
141-
*
142-
* @since 2.7.12
143141
*/
144142
private int minIdle = 0;
145143

@@ -163,8 +161,6 @@ public static class Pool {
163161
/**
164162
* Maximum time to validate a connection from the pool. By default, wait
165163
* indefinitely.
166-
*
167-
* @since 2.7.12
168164
*/
169165
private Duration maxValidationTime;
170166

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

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.HashMap;
3434
import java.util.List;
3535
import java.util.Map;
36+
import java.util.Objects;
3637
import java.util.stream.Collectors;
3738

3839
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
@@ -121,16 +122,16 @@ private JsonStream jsonStream() {
121122
return this.jsonStream;
122123
}
123124

124-
private URI buildUrl(String path, Collection<String> params) {
125-
return buildUrl(path, StringUtils.toStringArray(params));
125+
private URI buildUrl(String path, Collection<?> params) {
126+
return buildUrl(path, (params != null) ? params.toArray() : null);
126127
}
127128

128-
private URI buildUrl(String path, String... params) {
129+
private URI buildUrl(String path, Object... params) {
129130
try {
130131
URIBuilder builder = new URIBuilder("/" + API_VERSION + path);
131132
int param = 0;
132133
while (param < params.length) {
133-
builder.addParameter(params[param++], params[param++]);
134+
builder.addParameter(Objects.toString(params[param++]), Objects.toString(params[param++]));
134135
}
135136
return builder.build();
136137
}
@@ -190,7 +191,7 @@ public Image pull(ImageReference reference, UpdateListener<PullImageUpdateEvent>
190191
throws IOException {
191192
Assert.notNull(reference, "Reference must not be null");
192193
Assert.notNull(listener, "Listener must not be null");
193-
URI createUri = buildUrl("/images/create", "fromImage", reference.toString());
194+
URI createUri = buildUrl("/images/create", "fromImage", reference);
194195
DigestCaptureUpdateListener digestCapture = new DigestCaptureUpdateListener();
195196
listener.onStart();
196197
try {
@@ -348,14 +349,9 @@ public void tag(ImageReference sourceReference, ImageReference targetReference)
348349
Assert.notNull(sourceReference, "SourceReference must not be null");
349350
Assert.notNull(targetReference, "TargetReference must not be null");
350351
String tag = targetReference.getTag();
351-
URI uri;
352-
if (tag == null) {
353-
uri = buildUrl("/images/" + sourceReference + "/tag", "repo", targetReference.toString());
354-
}
355-
else {
356-
uri = buildUrl("/images/" + sourceReference + "/tag", "repo",
357-
targetReference.inTaglessForm().toString(), "tag", tag);
358-
}
352+
String path = "/images/" + sourceReference + "/tag";
353+
URI uri = (tag != null) ? buildUrl(path, "repo", targetReference.inTaglessForm(), "tag", tag)
354+
: buildUrl(path, "repo", targetReference);
359355
http().post(uri).close();
360356
}
361357

@@ -437,7 +433,7 @@ public void start(ContainerReference reference) throws IOException {
437433
public void logs(ContainerReference reference, UpdateListener<LogUpdateEvent> listener) throws IOException {
438434
Assert.notNull(reference, "Reference must not be null");
439435
Assert.notNull(listener, "Listener must not be null");
440-
String[] params = { "stdout", "1", "stderr", "1", "follow", "1" };
436+
Object[] params = { "stdout", "1", "stderr", "1", "follow", "1" };
441437
URI uri = buildUrl("/containers/" + reference + "/logs", params);
442438
listener.onStart();
443439
try {

0 commit comments

Comments
 (0)