Merge branch '2.1.x'

Closes gh-17335
Closes gh-17292
This commit is contained in:
Andy Wilkinson
2019-06-27 11:46:52 +01:00
11 changed files with 74 additions and 60 deletions

View File

@@ -350,12 +350,14 @@ 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();
}
}
}