Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ccc924b

Browse files
Merge branch '2.7.x'
2 parents bc273d6 + 508d0af commit ccc924b

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -254,8 +254,8 @@ private void writeEntry(JarArchiveEntry entry, EntryWriter entryWriter) throws I
254254
private void writeEntry(JarArchiveEntry entry, Library library, EntryWriter entryWriter,
255255
UnpackHandler unpackHandler) throws IOException {
256256
String name = entry.getName();
257-
writeParentDirectoryEntries(name);
258257
if (this.writtenEntries.add(name)) {
258+
writeParentDirectoryEntries(name);
259259
entry.setUnixMode(name.endsWith("/") ? UNIX_DIR_MODE : UNIX_FILE_MODE);
260260
entry.getGeneralPurposeBit().useUTF8ForNames(true);
261261
if (!entry.isDirectory() && entry.getSize() == -1) {

‎spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@
3838

3939
import org.springframework.boot.loader.tools.sample.ClassWithMainMethod;
4040
import org.springframework.util.FileCopyUtils;
41+
import org.springframework.util.StopWatch;
4142
import org.springframework.util.StringUtils;
4243

4344
import static org.assertj.core.api.Assertions.assertThat;
@@ -202,6 +203,18 @@ void allEntriesUseProvidedTimestamp() throws IOException {
202203
}
203204
}
204205

206+
@Test
207+
void repackagingDeeplyNestedPackageIsNotProhibitivelySlow() throws IOException {
208+
StopWatch stopWatch = new StopWatch();
209+
stopWatch.start();
210+
this.testJarFile.addClass("a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/Some.class",
211+
ClassWithMainMethod.class);
212+
Repackager repackager = createRepackager(this.testJarFile.getFile(), true);
213+
repackager.repackage(this.destination, NO_LIBRARIES, null, null);
214+
stopWatch.stop();
215+
assertThat(stopWatch.getTotalTimeMillis()).isLessThan(5000);
216+
}
217+
205218
private boolean hasLauncherClasses(File file) throws IOException {
206219
return hasEntry(file, "org/springframework/boot/")
207220
&& hasEntry(file, "org/springframework/boot/loader/JarLauncher.class");

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /