> +      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) {
> +         e.printStackTrace();

Properly log and propagate the exception to prevent the request from being sent?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/57/files#r10838367

Reply via email to