Skip to content

push leak ressource fix #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,32 @@ public static void tearDown() {
}
}

private static File setupFunctionZip(String jsFile) throws IOException {
InputStream in = IntegrationTestBase.class.getResourceAsStream(jsFile);

File zipFile = File.createTempFile("lambda-cloud-function", ".zip");
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile));
private static File setupFunctionZip(String jsFile) throws IOException {
try (InputStream in = IntegrationTestBase.class.getResourceAsStream(jsFile)) {

out.putNextEntry(new ZipEntry(jsFile));
File zipFile = File.createTempFile("lambda-cloud-function", ".zip");
try(ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile))) {

byte[] b = new byte[1024];
int count;
out.putNextEntry(new ZipEntry(jsFile));

while ((count = in.read(b)) != -1) {
out.write(b, 0, count);
}
byte[] b = new byte[1024];
int count;

out.close();
in.close();
while ((count = in.read(b)) != -1) {
out.write(b, 0, count);
}

return zipFile;
out.close();
in.close();
return zipFile;
} catch(IOException e) {
throw new UncheckedIOException(e);
}
}
catch(IOException e) {
throw new UncheckedIOException(e);
}
}

private static void createLambdaServiceRole() {
Expand Down