Exemple #1
0
  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());
      }
    }
  }
Exemple #2
0
 private File getAndValidateFile(String pFile, String pWhat) throws IOException {
   File ret = new File(pFile);
   if (!ret.exists()) {
     throw new FileNotFoundException("No such " + pWhat + " " + pFile);
   }
   if (!ret.canRead()) {
     throw new IOException(
         pWhat.substring(0, 1).toUpperCase()
             + pWhat.substring(1)
             + " "
             + pFile
             + " is not readable");
   }
   return ret;
 }