Skip to content

Commit 57db621

Browse files
committed
Polish
1 parent 77bbe08 commit 57db621

File tree

2 files changed

+9
-8
lines changed
  • spring-boot-project/spring-boot-tools
    • spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling
    • spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools

2 files changed

+9
-8
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ public void layered() {
177177
this.bootInf.eachFile((details) -> {
178178
Layer layer = layerForFileDetails(details);
179179
if (layer != null) {
180-
details.setPath(
181-
BOOT_INF_LAYERS + "/" + layer + "/" + details.getPath().substring("BOOT-INF/".length()));
180+
String relativePath = details.getPath().substring("BOOT-INF/".length());
181+
details.setPath(BOOT_INF_LAYERS + "/" + layer + "/" + relativePath);
182182
}
183183
}).setIncludeEmptyDirs(false);
184184
this.bootInf.into("", (spec) -> spec.from(createLayersIndex()));

spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ protected final void write(JarFile sourceJar, Libraries libraries, AbstractJarWr
159159
writeLoaderClasses(writer);
160160
writer.writeEntries(sourceJar, getEntityTransformer(), writeableLibraries);
161161
writeableLibraries.write(writer);
162+
162163
writeLayerIndex(writer);
163164
}
164165

@@ -425,14 +426,14 @@ private boolean isTransformable(JarArchiveEntry entry) {
425426
*/
426427
private final class WritableLibraries implements UnpackHandler {
427428

428-
private final Map<String, Library> libraryEntryNames = new LinkedHashMap<>();
429+
private final Map<String, Library> libraries = new LinkedHashMap<>();
429430

430431
WritableLibraries(Libraries libraries) throws IOException {
431432
libraries.doWithLibraries((library) -> {
432433
if (isZip(library.getFile())) {
433434
String location = getLocation(library);
434435
if (location != null) {
435-
Library existing = this.libraryEntryNames.putIfAbsent(location + library.getName(), library);
436+
Library existing = this.libraries.putIfAbsent(location + library.getName(), library);
436437
Assert.state(existing == null, "Duplicate library " + library.getName());
437438
}
438439
}
@@ -452,25 +453,25 @@ private String getLocation(Library library) {
452453

453454
@Override
454455
public boolean requiresUnpack(String name) {
455-
Library library = this.libraryEntryNames.get(name);
456+
Library library = this.libraries.get(name);
456457
return library != null && library.isUnpackRequired();
457458
}
458459

459460
@Override
460461
public String sha1Hash(String name) throws IOException {
461-
Library library = this.libraryEntryNames.get(name);
462+
Library library = this.libraries.get(name);
462463
Assert.notNull(library, "No library found for entry name '" + name + "'");
463464
return FileUtils.sha1Hash(library.getFile());
464465
}
465466

466467
private void write(AbstractJarWriter writer) throws IOException {
467-
for (Entry<String, Library> entry : this.libraryEntryNames.entrySet()) {
468+
for (Entry<String, Library> entry : this.libraries.entrySet()) {
468469
writer.writeNestedLibrary(entry.getKey().substring(0, entry.getKey().lastIndexOf('/') + 1),
469470
entry.getValue());
470471
}
471472
if (getLayout() instanceof RepackagingLayout) {
472473
String location = ((RepackagingLayout) getLayout()).getClasspathIndexFileLocation();
473-
writer.writeIndexFile(location, new ArrayList<>(this.libraryEntryNames.keySet()));
474+
writer.writeIndexFile(location, new ArrayList<>(this.libraries.keySet()));
474475
}
475476
}
476477

0 commit comments

Comments
 (0)