This commit is contained in:
Phillip Webb 2023-05-12 13:00:38 -07:00
parent 54e294c5c2
commit e9c4a5d663
3 changed files with 12 additions and 20 deletions

View File

@ -39,8 +39,8 @@ public class MailHealthIndicator extends AbstractHealthIndicator {
@Override @Override
protected void doHealthCheck(Builder builder) throws Exception { protected void doHealthCheck(Builder builder) throws Exception {
int port = this.mailSender.getPort(); int port = this.mailSender.getPort();
builder.withDetail("location", (port == JavaMailSenderImpl.DEFAULT_PORT) ? this.mailSender.getHost() builder.withDetail("location", (port != JavaMailSenderImpl.DEFAULT_PORT)
: this.mailSender.getHost() + ":" + this.mailSender.getPort()); ? this.mailSender.getHost() + ":" + this.mailSender.getPort() : this.mailSender.getHost());
this.mailSender.testConnection(); this.mailSender.testConnection();
builder.up(); builder.up();
} }

View File

@ -138,8 +138,6 @@ public class R2dbcProperties {
/** /**
* Minimal number of idle connections. * Minimal number of idle connections.
*
* @since 2.7.12
*/ */
private int minIdle = 0; private int minIdle = 0;
@ -163,8 +161,6 @@ public class R2dbcProperties {
/** /**
* Maximum time to validate a connection from the pool. By default, wait * Maximum time to validate a connection from the pool. By default, wait
* indefinitely. * indefinitely.
*
* @since 2.7.12
*/ */
private Duration maxValidationTime; private Duration maxValidationTime;

View File

@ -33,6 +33,7 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
@ -121,16 +122,16 @@ public class DockerApi {
return this.jsonStream; return this.jsonStream;
} }
private URI buildUrl(String path, Collection<String> params) { private URI buildUrl(String path, Collection<?> params) {
return buildUrl(path, StringUtils.toStringArray(params)); return buildUrl(path, (params != null) ? params.toArray() : null);
} }
private URI buildUrl(String path, String... params) { private URI buildUrl(String path, Object... params) {
try { try {
URIBuilder builder = new URIBuilder("/" + API_VERSION + path); URIBuilder builder = new URIBuilder("/" + API_VERSION + path);
int param = 0; int param = 0;
while (param < params.length) { while (param < params.length) {
builder.addParameter(params[param++], params[param++]); builder.addParameter(Objects.toString(params[param++]), Objects.toString(params[param++]));
} }
return builder.build(); return builder.build();
} }
@ -190,7 +191,7 @@ public class DockerApi {
throws IOException { throws IOException {
Assert.notNull(reference, "Reference must not be null"); Assert.notNull(reference, "Reference must not be null");
Assert.notNull(listener, "Listener must not be null"); Assert.notNull(listener, "Listener must not be null");
URI createUri = buildUrl("/images/create", "fromImage", reference.toString()); URI createUri = buildUrl("/images/create", "fromImage", reference);
DigestCaptureUpdateListener digestCapture = new DigestCaptureUpdateListener(); DigestCaptureUpdateListener digestCapture = new DigestCaptureUpdateListener();
listener.onStart(); listener.onStart();
try { try {
@ -348,14 +349,9 @@ public class DockerApi {
Assert.notNull(sourceReference, "SourceReference must not be null"); Assert.notNull(sourceReference, "SourceReference must not be null");
Assert.notNull(targetReference, "TargetReference must not be null"); Assert.notNull(targetReference, "TargetReference must not be null");
String tag = targetReference.getTag(); String tag = targetReference.getTag();
URI uri; String path = "/images/" + sourceReference + "/tag";
if (tag == null) { URI uri = (tag != null) ? buildUrl(path, "repo", targetReference.inTaglessForm(), "tag", tag)
uri = buildUrl("/images/" + sourceReference + "/tag", "repo", targetReference.toString()); : buildUrl(path, "repo", targetReference);
}
else {
uri = buildUrl("/images/" + sourceReference + "/tag", "repo",
targetReference.inTaglessForm().toString(), "tag", tag);
}
http().post(uri).close(); http().post(uri).close();
} }
@ -437,7 +433,7 @@ public class DockerApi {
public void logs(ContainerReference reference, UpdateListener<LogUpdateEvent> listener) throws IOException { public void logs(ContainerReference reference, UpdateListener<LogUpdateEvent> listener) throws IOException {
Assert.notNull(reference, "Reference must not be null"); Assert.notNull(reference, "Reference must not be null");
Assert.notNull(listener, "Listener must not be null"); Assert.notNull(listener, "Listener must not be null");
String[] params = { "stdout", "1", "stderr", "1", "follow", "1" }; Object[] params = { "stdout", "1", "stderr", "1", "follow", "1" };
URI uri = buildUrl("/containers/" + reference + "/logs", params); URI uri = buildUrl("/containers/" + reference + "/logs", params);
listener.onStart(); listener.onStart();
try { try {