From 105db66553432e26363e953f1ec1d45de15c93e4 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 23 Jan 2020 14:04:19 +0100 Subject: [PATCH] Polish --- .../platform/build/AbstractBuildLog.java | 2 +- .../buildpack/platform/build/BuildLog.java | 4 +- .../platform/build/BuildRequest.java | 22 +++--- .../buildpack/platform/build/Builder.java | 2 +- .../platform/build/BuilderMetadata.java | 2 +- .../buildpack/platform/build/Lifecycle.java | 8 +-- .../boot/buildpack/platform/build/Phase.java | 2 +- .../buildpack/platform/docker/DockerApi.java | 3 +- .../docker/DockerSchemePortResolver.java | 2 +- .../boot/buildpack/platform/docker/Http.java | 2 +- .../platform/docker/HttpClientHttp.java | 2 +- .../docker/TotalProgressPullListener.java | 7 +- .../platform/docker/type/ContainerConfig.java | 6 +- .../buildpack/platform/docker/type/Image.java | 4 +- .../platform/docker/type/ImageArchive.java | 8 +-- .../platform/docker/type/ImageConfig.java | 4 +- .../platform/docker/type/ImageName.java | 4 +- .../platform/docker/type/VolumeName.java | 2 +- .../platform/io/InspectedContent.java | 2 +- .../platform/io/TarLayoutWriter.java | 2 +- .../platform/socket/FileDescriptor.java | 2 +- .../platform/socket/NamedPipeSocket.java | 4 +- .../build/PrintStreamBuildLogTests.java | 2 +- .../boot/maven/AbstractPackagerMojo.java | 3 +- .../boot/maven/BuildImageMojo.java | 8 +-- .../boot/maven/LayoutType.java | 68 ------------------- 26 files changed, 49 insertions(+), 128 deletions(-) delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/LayoutType.java diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/AbstractBuildLog.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/AbstractBuildLog.java index 8436050a50..cf9a5d5b59 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/AbstractBuildLog.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/AbstractBuildLog.java @@ -45,7 +45,7 @@ public abstract class AbstractBuildLog implements BuildLog { } @Override - public void pulledBulder(BuildRequest request, Image image) { + public void pulledBuilder(BuildRequest request, Image image) { log(" > Pulled builder image '" + getDigest(image) + "'"); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildLog.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildLog.java index 5612d6a8af..ed71504a92 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildLog.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildLog.java @@ -53,7 +53,7 @@ public interface BuildLog { * @param request the build request * @param image the builder image that was pulled */ - void pulledBulder(BuildRequest request, Image image); + void pulledBuilder(BuildRequest request, Image image); /** * Log that a run image is being pulled. @@ -73,7 +73,7 @@ public interface BuildLog { /** * Log that the lifecycle is executing. * @param request the build request - * @param version the lifecyle version + * @param version the lifecycle version * @param buildCacheVolume the name of the build cache volume in use */ void executingLifecycle(BuildRequest request, LifecycleVersion version, VolumeName buildCacheVolume); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildRequest.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildRequest.java index ccaf53c9d4..464a000be6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildRequest.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildRequest.java @@ -47,7 +47,7 @@ public class BuildRequest { private final boolean cleanCache; - private final boolean versboseLogging; + private final boolean verboseLogging; BuildRequest(ImageReference name, Function applicationContent) { Assert.notNull(name, "Name must not be null"); @@ -57,17 +57,17 @@ public class BuildRequest { this.builder = DEFAULT_BUILDER; this.env = Collections.emptyMap(); this.cleanCache = false; - this.versboseLogging = false; + this.verboseLogging = false; } BuildRequest(ImageReference name, Function applicationContent, ImageReference builder, - Map env, boolean cleanCache, boolean versboseLogging) { + Map env, boolean cleanCache, boolean verboseLogging) { this.name = name; this.applicationContent = applicationContent; this.builder = builder; this.env = env; this.cleanCache = cleanCache; - this.versboseLogging = versboseLogging; + this.verboseLogging = verboseLogging; } /** @@ -78,7 +78,7 @@ public class BuildRequest { public BuildRequest withBuilder(ImageReference builder) { Assert.notNull(builder, "Builder must not be null"); return new BuildRequest(this.name, this.applicationContent, builder.inTaggedForm(), this.env, this.cleanCache, - this.versboseLogging); + this.verboseLogging); } /** @@ -90,10 +90,10 @@ public class BuildRequest { public BuildRequest withEnv(String name, String value) { Assert.hasText(name, "Name must not be empty"); Assert.hasText(value, "Value must not be empty"); - Map env = new LinkedHashMap(this.env); + Map env = new LinkedHashMap<>(this.env); env.put(name, value); return new BuildRequest(this.name, this.applicationContent, this.builder, Collections.unmodifiableMap(env), - this.cleanCache, this.versboseLogging); + this.cleanCache, this.verboseLogging); } /** @@ -103,10 +103,10 @@ public class BuildRequest { */ public BuildRequest withEnv(Map env) { Assert.notNull(env, "Env must not be null"); - Map updatedEnv = new LinkedHashMap(this.env); + Map updatedEnv = new LinkedHashMap<>(this.env); updatedEnv.putAll(env); return new BuildRequest(this.name, this.applicationContent, this.builder, - Collections.unmodifiableMap(updatedEnv), this.cleanCache, this.versboseLogging); + Collections.unmodifiableMap(updatedEnv), this.cleanCache, this.verboseLogging); } /** @@ -116,7 +116,7 @@ public class BuildRequest { */ public BuildRequest withCleanCache(boolean cleanCache) { return new BuildRequest(this.name, this.applicationContent, this.builder, this.env, cleanCache, - this.versboseLogging); + this.verboseLogging); } /** @@ -177,7 +177,7 @@ public class BuildRequest { * @return if verbose logging should be used */ public boolean isVerboseLogging() { - return this.versboseLogging; + return this.verboseLogging; } /** diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java index ea37c1c769..7fe3ec4e4b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java @@ -81,7 +81,7 @@ public class Builder { Consumer progressConsumer = this.log.pullingBuilder(request, builderImageReference); TotalProgressPullListener listener = new TotalProgressPullListener(progressConsumer); Image builderImage = this.docker.image().pull(builderImageReference, listener); - this.log.pulledBulder(request, builderImage); + this.log.pulledBuilder(request, builderImage); return builderImage; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuilderMetadata.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuilderMetadata.java index 5267a269e0..3d63fa7c69 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuilderMetadata.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuilderMetadata.java @@ -233,7 +233,7 @@ class BuilderMetadata extends MappedObject { */ static final class Update { - private ObjectNode copy; + private final ObjectNode copy; private Update(BuilderMetadata source) { this.copy = source.getNode().deepCopy(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Lifecycle.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Lifecycle.java index 33801ed951..615a21ad24 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Lifecycle.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Lifecycle.java @@ -70,16 +70,16 @@ class Lifecycle implements Closeable { * @param log build output log * @param docker the Docker API * @param request the request to process - * @param runImageReferece a reference to run image that should be used + * @param runImageReference a reference to run image that should be used * @param builder the ephemeral builder used to run the phases */ - Lifecycle(BuildLog log, DockerApi docker, BuildRequest request, ImageReference runImageReferece, + Lifecycle(BuildLog log, DockerApi docker, BuildRequest request, ImageReference runImageReference, EphemeralBuilder builder) { checkPlatformVersion(builder); this.log = log; this.docker = docker; this.request = request; - this.runImageReference = runImageReferece; + this.runImageReference = runImageReference; this.builder = builder; this.version = LifecycleVersion.parse(builder.getBuilderMetadata().getLifecycle().getVersion()); this.layersVolume = createRandomVolumeName("pack-layers-"); @@ -258,7 +258,7 @@ class Lifecycle implements Closeable { * convention of using {@code '/workspace'}. *

* Note that application content is uploaded to the container with the first phase - * that runs and saved in a volume that is passed to supsequent phases. The folder + * that runs and saved in a volume that is passed to subsequent phases. The folder * is mutable and buildpacks may modify the content. */ static final String APPLICATION = "/workspace"; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Phase.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Phase.java index bc16a257e8..dd6cbd4b69 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Phase.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Phase.java @@ -114,7 +114,7 @@ class Phase { } update.withCommand("/lifecycle/" + this.name, StringUtils.toStringArray(this.args)); update.withLabel("author", "spring-boot"); - this.binds.forEach((source, dest) -> update.withBind(source, dest)); + this.binds.forEach(update::withBind); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java index 631cfa11eb..0ca90f69cd 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java @@ -227,9 +227,8 @@ public class DockerApi { private ContainerReference createContainer(ContainerConfig config) throws IOException { URI createUri = buildUrl("/containers/create"); try (Response response = http().post(createUri, "application/json", config::writeTo)) { - ContainerReference containerReference = ContainerReference + return ContainerReference .of(SharedObjectMapper.get().readTree(response.getContent()).at("/Id").asText()); - return containerReference; } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerSchemePortResolver.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerSchemePortResolver.java index 69a4303941..6a32c93ddf 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerSchemePortResolver.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerSchemePortResolver.java @@ -28,7 +28,7 @@ import org.apache.http.util.Args; */ class DockerSchemePortResolver implements SchemePortResolver { - private static int DEFAULT_DOCKER_PORT = 2376; + private static final int DEFAULT_DOCKER_PORT = 2376; @Override public int resolve(HttpHost host) throws UnsupportedSchemeException { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/Http.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/Http.java index 3c7a4cdcac..b3ae1fa390 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/Http.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/Http.java @@ -82,7 +82,7 @@ interface Http { /** * Return the content of the response. - * @return the reseponse content + * @return the response content * @throws IOException on IO error */ InputStream getContent() throws IOException; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/HttpClientHttp.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/HttpClientHttp.java index 74e32016cc..011ae9dee7 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/HttpClientHttp.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/HttpClientHttp.java @@ -156,7 +156,7 @@ class HttpClientHttp implements Http { * * @author Phillip Webb */ - private class WritableHttpEntity extends AbstractHttpEntity { + private static class WritableHttpEntity extends AbstractHttpEntity { private final IOConsumer writer; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/TotalProgressPullListener.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/TotalProgressPullListener.java index 77aec7c78b..e8e8bf30dc 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/TotalProgressPullListener.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/TotalProgressPullListener.java @@ -93,10 +93,7 @@ public class TotalProgressPullListener implements UpdateListener 100) { - return 100; - } - return value; + return Math.min(value, 100); } /** @@ -125,7 +122,7 @@ public class TotalProgressPullListener implements UpdateListener current) ? result : current; + return Math.max(result, current); } void finish() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ContainerConfig.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ContainerConfig.java index 686df203f6..d2d03941a9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ContainerConfig.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ContainerConfig.java @@ -103,11 +103,11 @@ public class ContainerConfig { private String command; - private List args = new ArrayList<>(); + private final List args = new ArrayList<>(); - private Map labels = new LinkedHashMap<>(); + private final Map labels = new LinkedHashMap<>(); - private Map binds = new LinkedHashMap<>(); + private final Map binds = new LinkedHashMap<>(); Update(ImageReference image) { this.image = image; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/Image.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/Image.java index 4d2e2bec76..4864fe3d53 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/Image.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/Image.java @@ -41,7 +41,7 @@ public class Image extends MappedObject { private final ImageConfig config; - private List layers; + private final List layers; private final String os; @@ -104,7 +104,7 @@ public class Image extends MappedObject { /** * Create a new {@link Image} instance from the specified JSON content. * @param content the JSON content - * @return a new {@link Image} instace + * @return a new {@link Image} instance * @throws IOException on IO error */ public static Image of(InputStream content) throws IOException { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchive.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchive.java index 309f6664bd..665bc18164 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchive.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageArchive.java @@ -56,7 +56,7 @@ public class ImageArchive implements TarArchive { private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ISO_ZONED_DATE_TIME .withZone(ZoneOffset.UTC); - private static final IOConsumer NO_UPDDATES = (update) -> { + private static final IOConsumer NO_UPDATES = (update) -> { }; private final ObjectMapper objectMapper; @@ -189,14 +189,14 @@ public class ImageArchive implements TarArchive { ArrayNode manifest = this.objectMapper.createArrayNode(); ObjectNode entry = manifest.addObject(); entry.set("Config", entry.textNode(config)); - entry.set("Layers", getManfiestLayers(writtenLayers)); + entry.set("Layers", getManifestLayers(writtenLayers)); if (this.tag != null) { entry.set("RepoTags", entry.arrayNode().add(this.tag.toString())); } return manifest; } - private ArrayNode getManfiestLayers(List writtenLayers) { + private ArrayNode getManifestLayers(List writtenLayers) { ArrayNode layers = this.objectMapper.createArrayNode(); for (int i = 0; i < this.existingLayers.size(); i++) { layers.add(""); @@ -212,7 +212,7 @@ public class ImageArchive implements TarArchive { * @throws IOException on IO error */ public static ImageArchive from(Image image) throws IOException { - return from(image, NO_UPDDATES); + return from(image, NO_UPDATES); } /** diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageConfig.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageConfig.java index f24422d7fe..7ac21f115e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageConfig.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageConfig.java @@ -35,7 +35,7 @@ import org.springframework.boot.buildpack.platform.json.MappedObject; */ public class ImageConfig extends MappedObject { - private Map labels; + private final Map labels; private final Map configEnv; @@ -93,7 +93,7 @@ public class ImageConfig extends MappedObject { */ public static final class Update { - private ObjectNode copy; + private final ObjectNode copy; private Update(ImageConfig source) { this.copy = source.getNode().deepCopy(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageName.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageName.java index 2749cdf00d..0d30468466 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageName.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageName.java @@ -30,7 +30,7 @@ public class ImageName { private static final String DEFAULT_DOMAIN = "docker.io"; - private static final String OFFICAL_REPOSITORY_NAME = "library"; + private static final String OFFICIAL_REPOSITORY_NAME = "library"; private static final String LEGACY_DOMAIN = "index.docker.io"; @@ -128,7 +128,7 @@ public class ImageName { } } if (DEFAULT_DOMAIN.equals(domain) && !value.contains("/")) { - value = OFFICAL_REPOSITORY_NAME + "/" + value; + value = OFFICIAL_REPOSITORY_NAME + "/" + value; } return new String[] { domain, value }; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/VolumeName.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/VolumeName.java index 61dbfafd05..bc522c899f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/VolumeName.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/VolumeName.java @@ -132,7 +132,7 @@ public final class VolumeName { /** * Factory method to create a {@link VolumeName} with a specific value. - * @param value the volme reference value + * @param value the volume reference value * @return a new {@link VolumeName} instance */ public static VolumeName of(String value) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/InspectedContent.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/InspectedContent.java index e09a27c4c4..66aab11e7b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/InspectedContent.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/InspectedContent.java @@ -141,7 +141,7 @@ public class InspectedContent implements Content { private File tempFile; - private byte[] singleByteBuffer = new byte[0]; + private final byte[] singleByteBuffer = new byte[0]; private InspectingOutputStream(Inspector[] inspectors) { this.inspectors = inspectors; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/TarLayoutWriter.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/TarLayoutWriter.java index ffdc377aa0..3eddff38b2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/TarLayoutWriter.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/TarLayoutWriter.java @@ -35,7 +35,7 @@ class TarLayoutWriter implements Layout, Closeable { static final long NORMALIZED_MOD_TIME = TarArchive.NORMALIZED_TIME.toEpochMilli(); - private TarArchiveOutputStream outputStream; + private final TarArchiveOutputStream outputStream; TarLayoutWriter(OutputStream outputStream) { this.outputStream = new TarArchiveOutputStream(outputStream); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/FileDescriptor.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/FileDescriptor.java index f136188ded..fff9dbff90 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/FileDescriptor.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/FileDescriptor.java @@ -88,7 +88,7 @@ class FileDescriptor { */ private enum Status { - OPEN, CLOSE_PENDING, CLOSED; + OPEN, CLOSE_PENDING, CLOSED } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/NamedPipeSocket.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/NamedPipeSocket.java index 40f4015834..96fe572c85 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/NamedPipeSocket.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/NamedPipeSocket.java @@ -134,7 +134,7 @@ public class NamedPipeSocket extends Socket { /** * Waits for the name pipe file using a simple sleep. */ - private class SleepAwaiter implements Consumer { + private static class SleepAwaiter implements Consumer { @Override public void accept(String path) { @@ -150,7 +150,7 @@ public class NamedPipeSocket extends Socket { /** * Waits for the name pipe file using Windows specific logic. */ - private class WindowsAwaiter implements Consumer { + private static class WindowsAwaiter implements Consumer { @Override public void accept(String path) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/PrintStreamBuildLogTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/PrintStreamBuildLogTests.java index b4834e42c4..00bb5d0145 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/PrintStreamBuildLogTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/PrintStreamBuildLogTests.java @@ -59,7 +59,7 @@ class PrintStreamBuildLogTests { log.start(request); Consumer pullBuildImageConsumer = log.pullingBuilder(request, builderImageReference); pullBuildImageConsumer.accept(new TotalProgressEvent(100)); - log.pulledBulder(request, builderImage); + log.pulledBuilder(request, builderImage); Consumer pullRunImageConsumer = log.pullingRunImage(request, runImageReference); pullRunImageConsumer.accept(new TotalProgressEvent(100)); log.pulledRunImage(request, runImage); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java index 30c56e981c..50c3520192 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java @@ -130,8 +130,7 @@ public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo */ protected final Libraries getLibraries(Collection unpacks) throws MojoExecutionException { Set artifacts = filterDependencies(this.project.getArtifacts(), getFilters(getAdditionalFilters())); - Libraries libraries = new ArtifactsLibraries(artifacts, unpacks, getLog()); - return libraries; + return new ArtifactsLibraries(artifacts, unpacks, getLog()); } private ArtifactsFilter[] getAdditionalFilters() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageMojo.java index 47c89eadeb..9afa18a679 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageMojo.java @@ -30,7 +30,6 @@ import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; import org.apache.commons.compress.archivers.tar.TarConstants; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -65,41 +64,36 @@ public class BuildImageMojo extends AbstractPackagerMojo { /** * Directory containing the JAR. - * @since 2.3.0 */ @Parameter(defaultValue = "${project.build.directory}", required = true) private File sourceDirectory; /** * Name of the JAR. - * @since 2.3.0 */ @Parameter(defaultValue = "${project.build.finalName}", readonly = true) private String finalName; /** * Skip the execution. - * @since 2.3.0 */ @Parameter(property = "spring-boot.build-image.skip", defaultValue = "false") private boolean skip; /** * Classifier used when finding the source jar. - * @since 2.3.0 */ @Parameter private String classifier; /** * Image configuration operations. - * @since 2.3.0 */ @Parameter private Image image; @Override - public void execute() throws MojoExecutionException, MojoFailureException { + public void execute() throws MojoExecutionException { if (this.project.getPackaging().equals("pom")) { getLog().debug("build-image goal could not be applied to pom project."); return; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/LayoutType.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/LayoutType.java deleted file mode 100644 index 7029c30bc9..0000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/LayoutType.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2012-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.maven; - -import org.springframework.boot.loader.tools.Layout; -import org.springframework.boot.loader.tools.Layouts.Expanded; -import org.springframework.boot.loader.tools.Layouts.Jar; -import org.springframework.boot.loader.tools.Layouts.None; -import org.springframework.boot.loader.tools.Layouts.War; - -/** - * Archive layout types. - * - * @author Phillip Webb - * @since 2.3.0 - */ -public enum LayoutType { - - /** - * Jar Layout. - */ - JAR(new Jar()), - - /** - * War Layout. - */ - WAR(new War()), - - /** - * Zip Layout. - */ - ZIP(new Expanded()), - - /** - * Dir Layout. - */ - DIR(new Expanded()), - - /** - * No Layout. - */ - NONE(new None()); - - private final Layout layout; - - LayoutType(Layout layout) { - this.layout = layout; - } - - public Layout layout() { - return this.layout; - } - -}