code: private Issue handleMultipleIssuesForSameStacktrace(final List<Issue> pDuplicateIssues)
              throws IOException, AuthenticationException, NotFoundException, RedmineException {
  
          Collections.sort(pDuplicateIssues, new CreationDateIssueComparator());
  
          final Issue originalIssue = pDuplicateIssues.get(0);
  
          final List<Issue> issuesToClose = pDuplicateIssues.subList(1, pDuplicateIssues.size());
          if (LOGGER.isInfoEnabled()) {
              LOGGER.info("Closing issues {} duplicates of issue id={}",
                      Arrays.toString(issuesToClose.toArray()), originalIssue.getId());
          }
          for (final Issue issue : issuesToClose) {
  
              // add duplicate relation;
              final IssueRelation duplicate = new IssueRelation();
              duplicate.setIssueId(originalIssue.getId());
              duplicate.setType(config.CHILIPROJECT_RELATION_DUPLICATE_NAME);
              issue.getRelations().add(duplicate);
  
              // close issue
              issue.setStatusId(config.CHILIPROJECT_STATUS_CLOSED_ID);
  
              redmineClient.updateIssue(issue);
          }
  
          return originalIssue;
      }
docs: Invoked when detecting a duplicate issue (two issues with the same
  {@link ConfigurationManager#CHILIPROJECT_STACKTRACE_MD5_CF_ID} customfield value.
  <p>
  The oldest issue is kept, the others are closed.
  
  @param pDuplicateIssues
  the list of duplicate issues
  @return the kept issue
  @throws RedmineException
  @throws NotFoundException
  @throws AuthenticationException
  @throws IOException