Program: 99513
Project: 99513
Buggy source:
public static void writeIssue(Issue issue,final JSONWriter writer) throws JSONException {
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getSubject());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getParentId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getEstimatedHours());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getSpentHours());
  if (issue.getAssignee() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getAssignee().getId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getPriorityId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getDoneRatio());
  if (issue.getProject() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getProject().getIdentifier());
  if (issue.getAuthor() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getAuthor().getId());
  addShort2(writer,"String_Node_Str",issue.getStartDate());
  addIfNotNullShort2(writer,"String_Node_Str",issue.getDueDate());
  if (issue.getTracker() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getTracker().getId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getDescription());
  addIfNotNullFull(writer,"String_Node_Str",issue.getCreatedOn());
  addIfNotNullFull(writer,"String_Node_Str",issue.getUpdatedOn());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getStatusId());
  if (issue.getTargetVersion() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getTargetVersion().getId());
  if (issue.getCategory() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getCategory().getId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getNotes());
  writeCustomFields(writer,issue.getCustomFields());
  Collection<Watcher> issueWatchers=issue.getWatchers();
  if (issueWatchers != null && !issueWatchers.isEmpty()) {
    writeWatchers(writer,issueWatchers);
  }
  final List<Attachment> uploads=new ArrayList<Attachment>();
  for (  Attachment attachment : issue.getAttachments()) {
    if (attachment.getToken() != null) {
      uploads.add(attachment);
    }
  }
  JsonOutput.addArrayIfNotEmpty(writer,"String_Node_Str",uploads,UPLOAD_WRITER);
}

Fixed version (ground truth):
public static void writeIssue(Issue issue,final JSONWriter writer) throws JSONException {
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getSubject());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getParentId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getEstimatedHours());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getSpentHours());
  if (issue.getAssignee() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getAssignee().getId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getPriorityId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getDoneRatio());
  if (issue.getProject() != null) {
    if (issue.getProject().getId() != null) {
      JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getProject().getId());
    }
 else {
      JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getProject().getIdentifier());
    }
  }
  if (issue.getAuthor() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getAuthor().getId());
  addShort2(writer,"String_Node_Str",issue.getStartDate());
  addIfNotNullShort2(writer,"String_Node_Str",issue.getDueDate());
  if (issue.getTracker() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getTracker().getId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getDescription());
  addIfNotNullFull(writer,"String_Node_Str",issue.getCreatedOn());
  addIfNotNullFull(writer,"String_Node_Str",issue.getUpdatedOn());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getStatusId());
  if (issue.getTargetVersion() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getTargetVersion().getId());
  if (issue.getCategory() != null)   JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getCategory().getId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",issue.getNotes());
  writeCustomFields(writer,issue.getCustomFields());
  Collection<Watcher> issueWatchers=issue.getWatchers();
  if (issueWatchers != null && !issueWatchers.isEmpty()) {
    writeWatchers(writer,issueWatchers);
  }
  final List<Attachment> uploads=new ArrayList<Attachment>();
  for (  Attachment attachment : issue.getAttachments()) {
    if (attachment.getToken() != null) {
      uploads.add(attachment);
    }
  }
  JsonOutput.addArrayIfNotEmpty(writer,"String_Node_Str",uploads,UPLOAD_WRITER);
}