diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/CheckLinks.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/CheckLinks.java index ca5a71b187d9..77bcfebf32c5 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/CheckLinks.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/CheckLinks.java @@ -64,8 +64,8 @@ void releaseNotes() { try { uri = new URI(link); ResponseEntity response = restTemplate.exchange(uri, HttpMethod.HEAD, null, String.class); - System.out.println("[%3d] %s - %s (%s)".formatted(response.getStatusCode().value(), - library.getName(), name, uri)); + System.out.printf("[%3d] %s - %s (%s)%n", response.getStatusCode().value(), library.getName(), name, + uri); } catch (URISyntaxException ex) { throw new RuntimeException(ex); diff --git a/buildSrc/src/main/java/org/springframework/boot/build/test/DockerTestPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/test/DockerTestPlugin.java index 017ca001a43b..b2970b2ed240 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/test/DockerTestPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/test/DockerTestPlugin.java @@ -98,7 +98,7 @@ private SourceSet createSourceSet(Project project) { private Provider createTestTask(Project project, SourceSet dockerTestSourceSet, Provider buildService) { - Provider dockerTest = project.getTasks().register(DOCKER_TEST_TASK_NAME, Test.class, (task) -> { + return project.getTasks().register(DOCKER_TEST_TASK_NAME, Test.class, (task) -> { task.usesService(buildService); task.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP); task.setDescription("Runs Docker-based tests."); @@ -106,7 +106,6 @@ private Provider createTestTask(Project project, SourceSet dockerTestSourc task.setClasspath(dockerTestSourceSet.getRuntimeClasspath()); task.shouldRunAfter(JavaPlugin.TEST_TASK_NAME); }); - return dockerTest; } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntriesStream.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntriesStream.java index 35d9421874b4..3bb8419fb952 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntriesStream.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntriesStream.java @@ -54,9 +54,6 @@ class JarEntriesStream implements Closeable { JarEntry getNextEntry() throws IOException { this.entry = this.in.getNextJarEntry(); - if (this.entry != null) { - this.entry.getSize(); - } this.inflater.reset(); return this.entry; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlConnection.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlConnection.java index b188b0a8ddfa..038751f43281 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlConnection.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlConnection.java @@ -211,9 +211,9 @@ public boolean getAllowUserInteraction() { } @Override - public void setAllowUserInteraction(boolean allowuserinteraction) { + public void setAllowUserInteraction(boolean allowUserInteraction) { if (this.jarFileConnection != null) { - this.jarFileConnection.setAllowUserInteraction(allowuserinteraction); + this.jarFileConnection.setAllowUserInteraction(allowUserInteraction); } } @@ -223,9 +223,9 @@ public boolean getUseCaches() { } @Override - public void setUseCaches(boolean usecaches) { + public void setUseCaches(boolean useCaches) { if (this.jarFileConnection != null) { - this.jarFileConnection.setUseCaches(usecaches); + this.jarFileConnection.setUseCaches(useCaches); } } @@ -235,9 +235,9 @@ public boolean getDefaultUseCaches() { } @Override - public void setDefaultUseCaches(boolean defaultusecaches) { + public void setDefaultUseCaches(boolean defaultUseCaches) { if (this.jarFileConnection != null) { - this.jarFileConnection.setDefaultUseCaches(defaultusecaches); + this.jarFileConnection.setDefaultUseCaches(defaultUseCaches); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/LazyDelegatingInputStream.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/LazyDelegatingInputStream.java index 95e5cc3c14a7..ff47aa2debd6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/LazyDelegatingInputStream.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/LazyDelegatingInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 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. @@ -64,9 +64,9 @@ public boolean markSupported() { } @Override - public synchronized void mark(int readlimit) { + public synchronized void mark(int readLimit) { try { - in().mark(readlimit); + in().mark(readLimit); } catch (IOException ex) { // Ignore diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/NestedFileSystem.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/NestedFileSystem.java index 1cbdf94d7644..544020595414 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/NestedFileSystem.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/NestedFileSystem.java @@ -98,11 +98,9 @@ private boolean hasFileSystem(URI uri) { private boolean isCreatingNewFileSystem() { StackTraceElement[] stack = Thread.currentThread().getStackTrace(); - if (stack != null) { - for (StackTraceElement element : stack) { - if (FILE_SYSTEMS_CLASS_NAME.equals(element.getClassName())) { - return "newFileSystem".equals(element.getMethodName()); - } + for (StackTraceElement element : stack) { + if (FILE_SYSTEMS_CLASS_NAME.equals(element.getClassName())) { + return "newFileSystem".equals(element.getMethodName()); } } return false; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/NestedFileSystemProvider.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/NestedFileSystemProvider.java index ca136748df8c..fce7e8c56580 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/NestedFileSystemProvider.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/NestedFileSystemProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2024 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. @@ -50,7 +50,7 @@ */ public class NestedFileSystemProvider extends FileSystemProvider { - private Map fileSystems = new HashMap<>(); + private final Map fileSystems = new HashMap<>(); @Override public String getScheme() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/UriPathEncoder.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/UriPathEncoder.java index a58f252a6f42..9b96ef3c93e2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/UriPathEncoder.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/nio/file/UriPathEncoder.java @@ -28,7 +28,7 @@ final class UriPathEncoder { // Based on org.springframework.web.util.UriUtils - private static char[] ALLOWED = "/:@-._~!$&\'()*+,;=".toCharArray(); + private static final char[] ALLOWED = "/:@-._~!$&\'()*+,;=".toCharArray(); private UriPathEncoder() { }