Merge branch '2.7.x'

Closes gh-31178
This commit is contained in:
Andy Wilkinson
2022-05-26 15:54:58 +01:00
68 changed files with 137 additions and 166 deletions

View File

@@ -92,7 +92,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
protected TestJarFile testJarFile;
@BeforeEach
void setup() throws IOException {
void setup() {
this.testJarFile = new TestJarFile(this.tempDir);
}
@@ -628,7 +628,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
return new Library(null, file, scope, null, unpackRequired, false, included);
}
protected final P createPackager() throws IOException {
protected final P createPackager() {
return createPackager(this.testJarFile.getFile());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.springframework.boot.loader.tools;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.jar.JarFile;
@@ -45,7 +44,7 @@ class MainClassFinderTests {
private TestJarFile testJarFile;
@BeforeEach
void setup(@TempDir File tempDir) throws IOException {
void setup(@TempDir File tempDir) {
this.testJarFile = new TestJarFile(tempDir);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public class TestJarFile {
private final List<ZipEntrySource> entries = new ArrayList<>();
public TestJarFile(File temporaryDirectory) throws IOException {
public TestJarFile(File temporaryDirectory) {
this.temporaryDirectory = temporaryDirectory;
this.jarSource = new File(temporaryDirectory, "jar-source");
}
@@ -115,11 +115,11 @@ public class TestJarFile {
return this.jarSource;
}
public File getFile() throws IOException {
public File getFile() {
return getFile("jar");
}
public File getFile(String extension) throws IOException {
public File getFile(String extension) {
File file = new File(this.temporaryDirectory, UUID.randomUUID() + "." + extension);
ZipUtil.pack(this.entries.toArray(new ZipEntrySource[0]), file);
return file;