Skip to content

Commit 527b2f2

Browse files
committed
Polish
1 parent dc45532 commit 527b2f2

File tree

3 files changed

+28
-30
lines changed

3 files changed

+28
-30
lines changed

buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -109,31 +109,13 @@ private void applyUpgrades(GitHubRepository repository, List<String> issueLabels
109109
Issue existingUpgradeIssue = findExistingUpgradeIssue(existingUpgradeIssues, upgrade);
110110
try {
111111
Path modified = upgradeApplicator.apply(upgrade);
112-
int issueNumber;
113-
if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.OPEN) {
114-
issueNumber = existingUpgradeIssue.getNumber();
115-
}
116-
else {
117-
issueNumber = repository.openIssue(title,
118-
(existingUpgradeIssue != null) ? "Supersedes #" + existingUpgradeIssue.getNumber() : "",
119-
issueLabels, milestone);
120-
if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.CLOSED) {
121-
existingUpgradeIssue.label(Arrays.asList("type: task", "status: superseded"));
122-
}
123-
}
124-
if (existingUpgradeIssue != null) {
125-
if (existingUpgradeIssue.getState() == Issue.State.CLOSED) {
126-
System.out.println(" Issue: " + issueNumber + " - " + title + " (supersedes #"
127-
+ existingUpgradeIssue.getNumber() + " " + existingUpgradeIssue.getTitle() + ")");
128-
}
129-
else {
130-
System.out
131-
.println(" Issue: " + issueNumber + " - " + title + " (completes existing upgrade)");
132-
}
133-
}
134-
else {
135-
System.out.println(" Issue: " + issueNumber + " - " + title);
112+
int issueNumber = getOrOpenUpgradeIssue(repository, issueLabels, milestone, title,
113+
existingUpgradeIssue);
114+
if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.CLOSED) {
115+
existingUpgradeIssue.label(Arrays.asList("type: task", "status: superseded"));
136116
}
117+
System.out.println(" Issue: " + issueNumber + " - " + title
118+
+ getExistingUpgradeIssueMessageDetails(existingUpgradeIssue));
137119
if (new ProcessBuilder().command("git", "add", modified.toFile().getAbsolutePath())
138120
.start()
139121
.waitFor() != 0) {
@@ -154,6 +136,25 @@ private void applyUpgrades(GitHubRepository repository, List<String> issueLabels
154136
}
155137
}
156138

139+
private int getOrOpenUpgradeIssue(GitHubRepository repository, List<String> issueLabels, Milestone milestone,
140+
String title, Issue existingUpgradeIssue) {
141+
if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.OPEN) {
142+
return existingUpgradeIssue.getNumber();
143+
}
144+
String body = (existingUpgradeIssue != null) ? "Supersedes #" + existingUpgradeIssue.getNumber() : "";
145+
return repository.openIssue(title, body, issueLabels, milestone);
146+
}
147+
148+
private String getExistingUpgradeIssueMessageDetails(Issue existingUpgradeIssue) {
149+
if (existingUpgradeIssue == null) {
150+
return "";
151+
}
152+
if (existingUpgradeIssue.getState() != Issue.State.CLOSED) {
153+
return " (completes existing upgrade)";
154+
}
155+
return " (supersedes #" + existingUpgradeIssue.getNumber() + " " + existingUpgradeIssue.getTitle() + ")";
156+
}
157+
157158
private List<String> verifyLabels(GitHubRepository repository) {
158159
Set<String> availableLabels = repository.getLabels();
159160
List<String> issueLabels = this.bom.getUpgrade().getGitHub().getIssueLabels();

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherApplicationRunner.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ public JobLauncherApplicationRunner(JobLauncher jobLauncher, JobExplorer jobExpl
117117
public void afterPropertiesSet() {
118118
if (StringUtils.hasText(this.jobNames)) {
119119
for (String jobName : jobsToRun()) {
120-
if (!isLocalJob(jobName) && !isRegisteredJob(jobName)) {
121-
throw new IllegalArgumentException("No job found with name '" + jobName + "'");
122-
}
120+
Assert.isTrue(isLocalJob(jobName) || isRegisteredJob(jobName),
121+
() -> "No job found with name '" + jobName + "'");
123122
}
124123
}
125124
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,7 @@ private void reportConfigurationErrorsIfNecessary(LoggerContext loggerContext) {
187187
}
188188
IllegalStateException ex = new IllegalStateException(
189189
String.format("Logback configuration error detected: %n%s", errors));
190-
for (Throwable suppressedException : suppressedExceptions) {
191-
ex.addSuppressed(suppressedException);
192-
}
190+
suppressedExceptions.forEach(ex::addSuppressed);
193191
throw ex;
194192
}
195193

0 commit comments

Comments
 (0)