public void uploadAttachments(JiraTickets tickets) throws ExecutionException, InterruptedException, IOException { for (JiraTicket t : tickets) { Promise<Issue> issuePromise = issueRestClient.getIssue(t.getId()); Issue i = issuePromise.get(); File rollback = t.getRollback(); File hotfix = t.getHotfix(); if (rollback != null && rollback.canRead()) { issueRestClient.addAttachment( i.getAttachmentsUri(), FileUtils.openInputStream(rollback), rollback.getName()); } if (hotfix != null && hotfix.canRead()) { issueRestClient.addAttachment( i.getAttachmentsUri(), FileUtils.openInputStream(hotfix), hotfix.getName()); } } }