> + checkArgument(checkNotNull(input, "input") instanceof File, "this
> binder is only valid for File!");
> + checkNotNull(request, "request");
> +
> + File dockerFile = (File) input;
> + File tmpDir = Files.createTempDir();
> + final File targetFile = new File(tmpDir + File.separator +
> "Dockerfile");
> + try {
> + Files.copy(dockerFile, targetFile);
> + File archive = Archives.tar(tmpDir, File.createTempFile("archive",
> ".tar"));
> + FileInputStream data = new FileInputStream(archive);
> + Payload payload = Payloads.newInputStreamPayload(data);
> +
> payload.getContentMetadata().setContentLength(data.getChannel().size());
> + payload.getContentMetadata().setContentType(MediaType.TEXT_PLAIN);
> + request.setPayload(payload);
> + } catch (IOException e) {
> + logger.error("Couldn't create a tarball for {}", targetFile, e);
The throwable argument should be the first one, otherwise it will be considered
as a message parameter. jclouds logger also uses String.format, so the `{}`
placeholder should be replaced by `%s`.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/57/files#r11265181