Skip to content

Commit a55a6be

Browse files
committedMar 14, 2025
Merge branch '3.4.x'
2 parents f21304e + 6eb7d34 commit a55a6be

File tree

2 files changed

+25
-27
lines changed
  • buildSrc/src/main/java/org/springframework/boot/build/springframework
  • spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport

2 files changed

+25
-27
lines changed
 

‎buildSrc/src/main/java/org/springframework/boot/build/springframework/CheckFactoriesFile.java

+24-23
Original file line numberDiff line numberDiff line change
@@ -96,31 +96,17 @@ void execute() {
9696
}
9797

9898
private void check(File factoriesFile) {
99-
Properties factories = load(factoriesFile);
99+
Properties properties = load(factoriesFile);
100100
Map<String, List<String>> problems = new LinkedHashMap<>();
101-
for (String key : factories.stringPropertyNames()) {
102-
List<String> values = Arrays
103-
.asList(StringUtils.commaDelimitedListToStringArray(factories.getProperty(key)));
104-
for (String value : values) {
105-
boolean found = find(value);
106-
if (!found) {
107-
List<String> problemsForKey = problems.computeIfAbsent(key, (k) -> new ArrayList<>());
108-
String binaryName = binaryNameOf(value);
109-
found = find(binaryName);
110-
if (found) {
111-
problemsForKey
112-
.add("'%s' should be listed using its binary name '%s'".formatted(value, binaryName));
113-
}
114-
else {
115-
problemsForKey.add("'%s' was not found".formatted(value));
116-
}
117-
}
118-
}
119-
List<String> sortedValues = new ArrayList<>(values);
101+
for (String name : properties.stringPropertyNames()) {
102+
String value = properties.getProperty(name);
103+
List<String> classNames = Arrays.asList(StringUtils.commaDelimitedListToStringArray(value));
104+
collectProblems(problems, name, classNames);
105+
List<String> sortedValues = new ArrayList<>(classNames);
120106
Collections.sort(sortedValues);
121-
if (!sortedValues.equals(values)) {
122-
List<String> problemsForKey = problems.computeIfAbsent(key, (k) -> new ArrayList<>());
123-
problemsForKey.add("Entries should be sorted alphabetically");
107+
if (!sortedValues.equals(classNames)) {
108+
List<String> problemsForClassName = problems.computeIfAbsent(name, (k) -> new ArrayList<>());
109+
problemsForClassName.add("Entries should be sorted alphabetically");
124110
}
125111
}
126112
File outputFile = getOutputDirectory().file("failure-report.txt").get().getAsFile();
@@ -130,6 +116,21 @@ private void check(File factoriesFile) {
130116
}
131117
}
132118

119+
private void collectProblems(Map<String, List<String>> problems, String key, List<String> classNames) {
120+
for (String className : classNames) {
121+
if (!find(className)) {
122+
addNoFoundProblem(className, problems.computeIfAbsent(key, (k) -> new ArrayList<>()));
123+
}
124+
}
125+
}
126+
127+
private void addNoFoundProblem(String className, List<String> problemsForClassName) {
128+
String binaryName = binaryNameOf(className);
129+
boolean foundBinaryForm = find(binaryName);
130+
problemsForClassName.add(!foundBinaryForm ? "'%s' was not found".formatted(className)
131+
: "'%s' should be listed using its binary name '%s'".formatted(className, binaryName));
132+
}
133+
133134
private boolean find(String className) {
134135
for (File root : this.classpath.getFiles()) {
135136
String classFilePath = className.replace(".", "/") + ".class";

‎spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/HttpClientTransport.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,7 @@ private byte[] readContent(ClassicHttpResponse response) throws IOException {
179179
return null;
180180
}
181181
try (InputStream stream = entity.getContent()) {
182-
if (stream == null) {
183-
return null;
184-
}
185-
return stream.readAllBytes();
182+
return (stream != null) ? stream.readAllBytes() : null;
186183
}
187184
}
188185

0 commit comments

Comments
 (0)
Failed to load comments.