Skip to content

Commit fabc42f

Browse files
author
Vincent Potucek
committed
[S1132] Fix NPE add org.springframework.boot.openrewrite.SanityCheck#EqualsAvoidsNull spring-projects#48530
Signed-off-by: Vincent Potucek <vpotucek@me.com>
1 parent 61e427c commit fabc42f

23 files changed

+107
-51
lines changed

.github/workflows/build-pull-request.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
name: Build Pull Request
1+
name: Build Pull Request 🏭️
22
on: pull_request
33
permissions:
44
contents: read
55
jobs:
66
build:
7-
name: Build Pull Request
7+
name: Build 🏗
88
if: ${{ github.repository == 'spring-projects/spring-boot' }}
99
runs-on: ${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }}
1010
steps:
11-
- name: Check Out Code
11+
- name: Checkout Code 📥
1212
uses: actions/checkout@v6
13-
- name: Build
13+
- name: Build 📦
1414
id: build
1515
uses: ./.github/actions/build
16-
- name: Print JVM Thread Dumps When Cancelled
16+
- name: Log Potentially Cancelled JVM Thread Dumps 📋
1717
if: cancelled()
1818
uses: ./.github/actions/print-jvm-thread-dumps
19-
- name: Upload Build Reports
19+
- name: Upload Build Report 📊
2020
if: failure()
2121
uses: actions/upload-artifact@v5
2222
with:

.github/workflows/distribute.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ permissions:
1919
contents: read
2020
jobs:
2121
distribute-spring-enterprise-release-bundle:
22+
name: Distribute Release Bundle 📦
2223
runs-on: ${{ vars.UBUNTU_SMALL || 'ubuntu-latest' }}
2324
steps:
2425
- name: Create Bundle

.github/workflows/run-codeql-analysis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: "Run CodeQL Analysis"
1+
name: Run CodeQL Analysis 📊
22
on:
33
push:
44
pull_request:
55
workflow_dispatch:
66
permissions: read-all
77
jobs:
88
run-analysis:
9+
name: Inspect 🔎
910
permissions:
1011
actions: read
1112
contents: read

.github/workflows/sanity.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Sanity Check 🕊️
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
permissions: read-all
7+
jobs:
8+
verify:
9+
name: Verify 📊
10+
if: ${{ github.repository == 'spring-projects/spring-boot' }}
11+
runs-on: ${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }}
12+
steps:
13+
- name: Checkout Code 📥
14+
uses: actions/checkout@v6
15+
- name: Build 📦
16+
id: build
17+
uses: ./.github/actions/build
18+
- name: Rewrite ♻️
19+
run: ./gradlew rewriteDryRun

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
plugins {
1818
id "base"
19+
id "org.openrewrite.rewrite" version "7.22.0" apply false
1920
}
2021

2122
description = "Spring Boot Build"
@@ -46,3 +47,5 @@ subprojects {
4647
resolutionStrategy.cacheChangingModulesFor 0, "minutes"
4748
}
4849
}
50+
51+
apply from: rootProject.file("${rootDir}/gradle/plugins/config/sanity.gradle")

buildSrc/src/main/java/org/springframework/boot/build/DeployedPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ public void apply(Project project) {
4747
project.afterEvaluate((evaluated) -> project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> {
4848
if (((Jar) project.getTasks().getByName(JavaPlugin.JAR_TASK_NAME)).isEnabled()) {
4949
project.getComponents()
50-
.matching((component) -> component.getName().equals("java"))
50+
.matching((component) -> "java".equals(component.getName()))
5151
.all(mavenPublication::from);
5252
}
5353
}));
5454
project.getPlugins()
5555
.withType(JavaPlatformPlugin.class)
5656
.all((javaPlugin) -> project.getComponents()
57-
.matching((component) -> component.getName().equals("javaPlatform"))
57+
.matching((component) -> "javaPlatform".equals(component.getName()))
5858
.all(mavenPublication::from));
5959
}
6060

buildSrc/src/main/java/org/springframework/boot/build/MavenRepositoryPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ public void apply(Project project) {
6262
mavenRepository.setUrl(repositoryLocation.toURI());
6363
});
6464
project.getTasks()
65-
.matching((task) -> task.getName().equals(PUBLISH_TO_PROJECT_REPOSITORY_TASK_NAME))
65+
.matching((task) -> PUBLISH_TO_PROJECT_REPOSITORY_TASK_NAME.equals(task.getName()))
6666
.all((task) -> setUpProjectRepository(project, task, repositoryLocation));
6767
project.getTasks()
68-
.matching((task) -> task.getName().equals("publishPluginMavenPublicationToProjectRepository"))
68+
.matching((task) -> "publishPluginMavenPublicationToProjectRepository".equals(task.getName()))
6969
.all((task) -> setUpProjectRepository(project, task, repositoryLocation));
7070
}
7171

buildSrc/src/main/java/org/springframework/boot/build/antora/CheckJavadocMacros.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ private WellKnownAnchor(Origin origin) {
336336
}
337337

338338
private static WellKnownAnchor of(String anchor, Origin origin) {
339-
if (anchor.equals("enum-constant-summary")) {
339+
if ("enum-constant-summary".equals(anchor)) {
340340
return new WellKnownAnchor(origin);
341341
}
342342
return null;

buildSrc/src/main/java/org/springframework/boot/build/architecture/AutoConfigurationChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private JavaClass[] getImportedClasses(JavaClass javaClass) {
117117

118118
private boolean isBootClass(JavaClass javaClass) {
119119
String pkg = javaClass.getPackage().getName();
120-
return pkg.equals(SPRING_BOOT_ROOT_PACKAGE) || pkg.startsWith(SPRING_BOOT_ROOT_PACKAGE + ".");
120+
return SPRING_BOOT_ROOT_PACKAGE.equals(pkg) || pkg.startsWith(SPRING_BOOT_ROOT_PACKAGE + ".");
121121
}
122122

123123
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public List<LibraryWithVersionOptions> findLibraryUpdates(Collection<Library> li
7474
}
7575

7676
protected boolean isLibraryExcluded(Library library) {
77-
return library.getName().equals("Spring Boot");
77+
return "Spring Boot".equals(library.getName());
7878
}
7979

8080
protected List<VersionOption> getVersionOptions(Library library) {

0 commit comments

Comments
 (0)