Merge branch '2.0.x' into 2.1.x

Closes gh-17334
This commit is contained in:
Andy Wilkinson
2019-06-27 11:39:17 +01:00
5 changed files with 64 additions and 50 deletions

View File

@@ -359,12 +359,14 @@ public class InitCommandTests extends AbstractHttpClientMockTests {
}
private byte[] createFakeZipArchive(String fileName, String content) throws IOException {
try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(bos)) {
ZipEntry entry = new ZipEntry(fileName);
zos.putNextEntry(entry);
zos.write(content.getBytes());
zos.closeEntry();
return bos.toByteArray();
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
try (ZipOutputStream zos = new ZipOutputStream(bos)) {
ZipEntry entry = new ZipEntry(fileName);
zos.putNextEntry(entry);
zos.write(content.getBytes());
zos.closeEntry();
return bos.toByteArray();
}
}
}