diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java index d605002e9c..653fe98be8 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java @@ -108,31 +108,13 @@ public abstract class UpgradeDependencies extends DefaultTask { Issue existingUpgradeIssue = findExistingUpgradeIssue(existingUpgradeIssues, upgrade); try { Path modified = upgradeApplicator.apply(upgrade); - int issueNumber; - if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.OPEN) { - issueNumber = existingUpgradeIssue.getNumber(); - } - else { - issueNumber = repository.openIssue(title, - (existingUpgradeIssue != null) ? "Supersedes #" + existingUpgradeIssue.getNumber() : "", - issueLabels, milestone); - if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.CLOSED) { - existingUpgradeIssue.label(Arrays.asList("type: task", "status: superseded")); - } - } - if (existingUpgradeIssue != null) { - if (existingUpgradeIssue.getState() == Issue.State.CLOSED) { - System.out.println(" Issue: " + issueNumber + " - " + title + " (supersedes #" - + existingUpgradeIssue.getNumber() + " " + existingUpgradeIssue.getTitle() + ")"); - } - else { - System.out - .println(" Issue: " + issueNumber + " - " + title + " (completes existing upgrade)"); - } - } - else { - System.out.println(" Issue: " + issueNumber + " - " + title); + int issueNumber = getOrOpenUpgradeIssue(repository, issueLabels, milestone, title, + existingUpgradeIssue); + if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.CLOSED) { + existingUpgradeIssue.label(Arrays.asList("type: task", "status: superseded")); } + System.out.println(" Issue: " + issueNumber + " - " + title + + getExistingUpgradeIssueMessageDetails(existingUpgradeIssue)); if (new ProcessBuilder().command("git", "add", modified.toFile().getAbsolutePath()) .start() .waitFor() != 0) { @@ -153,6 +135,25 @@ public abstract class UpgradeDependencies extends DefaultTask { } } + private int getOrOpenUpgradeIssue(GitHubRepository repository, List issueLabels, Milestone milestone, + String title, Issue existingUpgradeIssue) { + if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.OPEN) { + return existingUpgradeIssue.getNumber(); + } + String body = (existingUpgradeIssue != null) ? "Supersedes #" + existingUpgradeIssue.getNumber() : ""; + return repository.openIssue(title, body, issueLabels, milestone); + } + + private String getExistingUpgradeIssueMessageDetails(Issue existingUpgradeIssue) { + if (existingUpgradeIssue == null) { + return ""; + } + if (existingUpgradeIssue.getState() != Issue.State.CLOSED) { + return " (completes existing upgrade)"; + } + return " (supersedes #" + existingUpgradeIssue.getNumber() + " " + existingUpgradeIssue.getTitle() + ")"; + } + private List verifyLabels(GitHubRepository repository) { Set availableLabels = repository.getLabels(); List issueLabels = this.bom.getUpgrade().getGitHub().getIssueLabels(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner.java index bc2e129f2e..a92e256473 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner.java @@ -113,13 +113,11 @@ public class JobLauncherApplicationRunner @Override public void afterPropertiesSet() { - if (this.jobs.size() > 1 && !StringUtils.hasText(this.jobName)) { - throw new IllegalArgumentException("Job name must be specified in case of multiple jobs"); - } + Assert.isTrue(this.jobs.size() <= 1 || StringUtils.hasText(this.jobName), + "Job name must be specified in case of multiple jobs"); if (StringUtils.hasText(this.jobName)) { - if (!isLocalJob(this.jobName) && !isRegisteredJob(this.jobName)) { - throw new IllegalArgumentException("No job found with name '" + this.jobName + "'"); - } + Assert.isTrue(isLocalJob(this.jobName) || isRegisteredJob(this.jobName), + () -> "No job found with name '" + this.jobName + "'"); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java index 5539bb5b6b..504044c9eb 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2023 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. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/ssl/KeyStoreFactoryTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/ssl/KeyStoreFactoryTests.java index 5168e37b55..837f5c4017 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/ssl/KeyStoreFactoryTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/ssl/KeyStoreFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2023 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. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java index e0003c510a..fd3de3a644 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java @@ -267,9 +267,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF } IllegalStateException ex = new IllegalStateException( String.format("Logback configuration error detected: %n%s", errors)); - for (Throwable suppressedException : suppressedExceptions) { - ex.addSuppressed(suppressedException); - } + suppressedExceptions.forEach(ex::addSuppressed); throw ex; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizer.java index 1aeb3c1a3a..d87e64059c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2023 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.