Merge branch '2.3.x'

Closes gh-22328
pull/22329/head
Andy Wilkinson 4 years ago
commit 972aab18f9

@ -98,8 +98,7 @@ final class SizeCalculatingEntryWriter implements EntryWriter {
private OutputStream outputStream;
SizeCalculatingOutputStream() throws IOException {
this.tempFile = File.createTempFile("springboot-", "-entrycontent");
SizeCalculatingOutputStream() {
this.outputStream = new ByteArrayOutputStream();
}
@ -119,11 +118,19 @@ final class SizeCalculatingEntryWriter implements EntryWriter {
}
private OutputStream convertToFileOutputStream(ByteArrayOutputStream byteArrayOutputStream) throws IOException {
initializeTempFile();
FileOutputStream fileOutputStream = new FileOutputStream(this.tempFile);
StreamUtils.copy(byteArrayOutputStream.toByteArray(), fileOutputStream);
return fileOutputStream;
}
private void initializeTempFile() throws IOException {
if (this.tempFile == null) {
this.tempFile = File.createTempFile("springboot-", "-entrycontent");
this.tempFile.deleteOnExit();
}
}
@Override
public void close() throws IOException {
this.outputStream.close();

Loading…
Cancel
Save