title: Downloading GitHub issues to .csv file
body: <p><em>GitHub issues download using eclipse egit doesn't return anything.</em></p>
  
  <p>Recently, i've been attempting to create a java desktop application (for windows), that will download GitHub issues from a specific GitHub issue repository, and save them in a .csv file.</p>
  
  <p>I've created a simple GUI using Swing to enable the input of repository names. I'm also using eclipse's egit library to establish a connection to GitHub in order to download issues. I use authentication, entered using a .properties file in order to authenticate egit's connection with GitHub.</p>
  
  <p>Here is the main code my application uses to download the issues and write them to a .csv file:</p>
  
  <pre><code>package io.github.psgs.issuesdownload;
  
  import io.github.psgs.issuesdownload.gui.GUI;
  import org.eclipse.egit.github.core.Issue;
  import org.eclipse.egit.github.core.client.GitHubClient;
  import org.eclipse.egit.github.core.service.IssueService;
  
  import java.io.FileWriter;
  import java.io.IOException;
  
  public class IssuesDownload {
  
      public static void main(String[] args) {
          try {
          Config.loadConfiguration();
          } catch(IOException ex) {
  
          }
          GUI.main(args);
      }
  
      public static String saveIssues(String repoDetails) {
          String[] repoInfo = repoDetails.split("/");
          String repoOwner = repoInfo[0];
          String repoName = repoInfo[1];
  
          GitHubClient client = new GitHubClient();
          client.setCredentials(Config.githubuser, Config.githubpass);
  
          IssueService issueService = new IssueService(client);
  
          try {
              FileWriter writer = new FileWriter("issues.csv");
              //String[] header = {"Id", "Title", "Creator", "Assignee", "Milestone", "State", "Body Text"};
              writer.append("Id, Title, Creator, Assignee, Milestone, State, Body Text");
              writer.append("\n");
  
              for (Issue issue : issueService.getIssues(repoOwner, repoName, null)) {
                  //String[] data = {String.valueOf(issue.getId()), issue.getTitle(), issue.getUser().getName(), issue.getAssignee().getName(), issue.getMilestone().getTitle(), issue.getState(), issue.getBodyText()};
                  writer.append(String.valueOf(issue.getId()) + ",");
                  writer.append(issue.getTitle() + ",");
                  writer.append(issue.getUser().getName() + ",");
                  writer.append(issue.getAssignee().getName() + ",");
                  writer.append(issue.getMilestone().getTitle() + ",");
                  writer.append(issue.getState() + ",");
                  writer.append(issue.getBodyText());
                  writer.append("\n");
              }
              writer.flush();
              writer.close();
              return "Download Complete!";
          } catch (IOException ex) {
              System.out.println("An IOException has occured!");
              ex.printStackTrace();
              if (ex.getMessage().equalsIgnoreCase("api.github.com")) {
                  return "An error has occured, reaching " + ex.getMessage() + "! Please check your network connection.";
              }
          }
          return "An error has occured!";
      }
  }
  </code></pre>
  
  <p>This code is also available at: <a href="https://gist.github.com/psgs/9048602" rel="nofollow">https://gist.github.com/psgs/9048602</a></p>
  
  <p>The whole repository can be found at: <a href="https://github.com/psgs/IssuesDownload" rel="nofollow">https://github.com/psgs/IssuesDownload</a></p>
  
  <p>When I run this code, with the .properties file in the same directory as the compile .jar file, the GitHub issues don't appear in the .csv file. I've tested the .csv file output, and the headers write correctly when I remove the download code.</p>
  
  <p>Would anybody know why this is happening? Perhaps it's an authentication problem that i've missed?</p>