From af2db82b223e048b8270829d91daa4d775f052f9 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Tue, 7 Aug 2018 09:48:07 +0900 Subject: [PATCH] Invoke Inflater.end() in ZipInflaterInputStream.close() Closes gh-14001 --- .../boot/loader/jar/ZipInflaterInputStream.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/ZipInflaterInputStream.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/ZipInflaterInputStream.java index 0678dc2e9f..cdc6974d49 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/ZipInflaterInputStream.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/ZipInflaterInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2018 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. @@ -30,12 +30,19 @@ import java.util.zip.InflaterInputStream; */ class ZipInflaterInputStream extends InflaterInputStream { + private final Inflater inflater; + private boolean extraBytesWritten; private int available; ZipInflaterInputStream(InputStream inputStream, int size) { - super(inputStream, new Inflater(true), getInflaterBufferSize(size)); + this(inputStream, new Inflater(true), size); + } + + private ZipInflaterInputStream(InputStream inputStream, Inflater inflater, int size) { + super(inputStream, inflater, getInflaterBufferSize(size)); + this.inflater = inflater; this.available = size; } @@ -56,6 +63,12 @@ class ZipInflaterInputStream extends InflaterInputStream { return result; } + @Override + public void close() throws IOException { + super.close(); + this.inflater.end(); + } + @Override protected void fill() throws IOException { try {