Program: 10656
Project: 10656
Buggy source:
protected void waitForFileExists(String recordingFile){
  boolean exists=false;
  String pathToMedia_[]=recordingFile.split("String_Node_Str");
  String protocol=pathToMedia_[0];
  String path=pathToMedia_[1];
  log.debug("String_Node_Str",recordingFile);
  long timeoutMs=System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(WAIT_POLL_TIME);
  do {
    if (Protocol.FILE.toString().equals(protocol)) {
      String output=Shell.runAndWaitString("String_Node_Str" + path);
      if (!output.contains("String_Node_Str")) {
        exists=true;
      }
    }
 else     if (Protocol.HTTP.toString().equals(protocol) || Protocol.HTTPS.toString().equals(protocol)) {
      exists=true;
    }
 else     if (Protocol.S3.toString().equals(protocol)) {
      String output=Shell.runAndWaitString("String_Node_Str" + recordingFile);
      if (!output.equals("String_Node_Str")) {
        exists=true;
      }
    }
 else     if (Protocol.MONGODB.toString().equals(protocol)) {
    }
    if (!exists) {
      if (System.currentTimeMillis() > timeoutMs) {
        throw new KurentoException("String_Node_Str" + WAIT_POLL_TIME + "String_Node_Str"+ recordingFile);
      }
      try {
        log.debug("String_Node_Str",recordingFile,WAIT_POLL_TIME);
        Thread.sleep(WAIT_POLL_TIME);
      }
 catch (      InterruptedException e) {
        log.error("String_Node_Str");
      }
    }
  }
 while (!exists);
}

Fixed version (ground truth):
protected void waitForFileExists(String recordingFile){
  boolean exists=false;
  String pathToMedia_[]=recordingFile.split("String_Node_Str");
  String protocol="String_Node_Str";
  String path="String_Node_Str";
  if (pathToMedia_.length > 1) {
    protocol=pathToMedia_[0];
    path=pathToMedia_[1];
  }
 else {
    String recordDefaultPath=KurentoTest.getRecordDefaultPath();
    if (recordDefaultPath != null) {
      String defaultPathToMedia_[]=recordDefaultPath.split("String_Node_Str");
      protocol=defaultPathToMedia_[0];
      String pathStart=defaultPathToMedia_[1];
      path=pathStart + pathToMedia_[0];
    }
  }
  log.debug("String_Node_Str",recordingFile);
  long timeoutMs=System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(WAIT_POLL_TIME);
  do {
    if (Protocol.FILE.toString().equals(protocol)) {
      String output=Shell.runAndWaitString("String_Node_Str" + path);
      if (!output.contains("String_Node_Str")) {
        exists=true;
      }
    }
 else     if (Protocol.HTTP.toString().equals(protocol) || Protocol.HTTPS.toString().equals(protocol)) {
      exists=true;
    }
 else     if (Protocol.S3.toString().equals(protocol)) {
      recordingFile=protocol + "String_Node_Str" + path;
      String output=Shell.runAndWaitString("String_Node_Str" + recordingFile);
      if (!output.equals("String_Node_Str")) {
        exists=true;
      }
    }
 else     if (Protocol.MONGODB.toString().equals(protocol)) {
    }
    if (!exists) {
      if (System.currentTimeMillis() > timeoutMs) {
        throw new KurentoException("String_Node_Str" + WAIT_POLL_TIME + "String_Node_Str"+ recordingFile);
      }
      try {
        log.debug("String_Node_Str",recordingFile,WAIT_POLL_TIME);
        Thread.sleep(WAIT_POLL_TIME);
      }
 catch (      InterruptedException e) {
        log.error("String_Node_Str");
      }
    }
  }
 while (!exists);
}