Program: 36872
Project: 36872
Buggy source:
/** 
 * start the poll upload process with a maximum of 2 minutes of polling with the following process: 1. create GET request 2. send GET request 3. get response 4. check response data 5. step 1 again until 2 minutes is up, there is an error, or status code 99 (no more requests for this key)
 */
private void pollUpload(){
  HashMap<String,String> keyValue=generateGetParameters();
  String request=sessionManager.getDomain() + getQueryString(POLL_UPLOAD_URI,keyValue);
  int pollCount=0;
  PollResponse response;
  do {
    pollCount++;
    String jsonResponse;
    try {
      jsonResponse=sessionManager.getHttpInterface().sendGetRequest(request);
    }
 catch (    IOException e) {
      notifyListenersException(uploadItem,e);
      return;
    }
    if (jsonResponse.isEmpty()) {
      notifyManagerLostConnection();
      return;
    }
    Gson gson=new Gson();
    response=gson.fromJson(getResponseString(jsonResponse),PollResponse.class);
switch (response.getErrorCode()) {
case NO_ERROR:
      if (response.getDoUpload().getResultCode() != PollResultCode.SUCCESS) {
        notifyManagerCancelled(response);
        return;
      }
    if (response.getDoUpload().getFileErrorCode() != PollFileErrorCode.NO_ERROR) {
      notifyManagerCancelled(response);
      return;
    }
  if (response.getDoUpload().getStatusCode() == PollStatusCode.NO_MORE_REQUESTS_FOR_THIS_KEY) {
    notifyManagerCompleted(response);
    return;
  }
break;
default :
notifyManagerCancelled(response);
return;
}
try {
Thread.sleep(TIME_BETWEEN_POLLS);
}
 catch (InterruptedException e) {
logger.error("String_Node_Str" + e);
Thread.currentThread().interrupt();
}
}
 while (pollCount < MAX_POLLS);
notifyManagerCompleted(response);
}

Fixed version (ground truth):
/** 
 * start the poll upload process with a maximum of 2 minutes of polling with the following process: 1. create GET request 2. send GET request 3. get response 4. check response data 5. step 1 again until 2 minutes is up, there is an error, or status code 99 (no more requests for this key)
 */
private void pollUpload(){
  HashMap<String,String> keyValue=generateGetParameters();
  String request=sessionManager.getDomain() + getQueryString(POLL_UPLOAD_URI,keyValue);
  int pollCount=0;
  PollResponse response;
  do {
    pollCount++;
    String jsonResponse;
    try {
      jsonResponse=sessionManager.getHttpInterface().sendGetRequest(request);
    }
 catch (    IOException e) {
      notifyListenersException(uploadItem,e);
      return;
    }
    if (jsonResponse.isEmpty()) {
      notifyManagerLostConnection();
      return;
    }
    Gson gson=new Gson();
    response=gson.fromJson(getResponseString(jsonResponse),PollResponse.class);
    logger.info("String_Node_Str" + response.getErrorCode());
switch (response.getErrorCode()) {
case NO_ERROR:
      if (response.getDoUpload().getResultCode() != PollResultCode.SUCCESS) {
        logger.info("String_Node_Str" + response.getDoUpload().getResultCode().toString() + "String_Node_Str");
        notifyManagerCancelled(response);
        return;
      }
    if (response.getDoUpload().getFileErrorCode() != PollFileErrorCode.NO_ERROR) {
      logger.info("String_Node_Str" + response.getDoUpload().getFileErrorCode().toString() + "String_Node_Str");
      logger.info("String_Node_Str" + uploadItem.getFileData().getFilePath());
      logger.info("String_Node_Str" + uploadItem.getFileData().getFileHash());
      logger.info("String_Node_Str" + uploadItem.getFileData().getFileSize());
      notifyManagerCancelled(response);
      return;
    }
  if (response.getDoUpload().getStatusCode() == PollStatusCode.NO_MORE_REQUESTS_FOR_THIS_KEY) {
    logger.info("String_Node_Str" + response.getDoUpload().getStatusCode().toString() + "String_Node_Str");
    notifyManagerCompleted(response);
    return;
  }
break;
default :
notifyManagerCancelled(response);
return;
}
try {
Thread.sleep(TIME_BETWEEN_POLLS);
}
 catch (InterruptedException e) {
logger.error("String_Node_Str" + e);
notifyManagerCompleted(response);
Thread.currentThread().interrupt();
}
}
 while (pollCount < MAX_POLLS);
notifyManagerCompleted(response);
}