Program: 130579
Project: 130579
Buggy source:
/** 
 * Try random directories until we get a successful dir stream, falling back to the pre-configured authorities after MAX_TRIES, or if we don't have an existing consensus If you're having speed issues, try adding "Fast" to the lists of flags below.
 * @param path Desired dir path
 * @return InputStream for reading
 * @throws RuntimeException when it fails to download path after MAX_TRIES tries
 */
public InputStream getDirectoryStream(String path) throws RuntimeException {
  String directoryType="String_Node_Str";
  if (consensus != null && useOnlyAuthorities) {
    int dirRouterCount=getORsWithFlag("String_Node_Str").size();
    int dirTriesLimit=Math.min(dirRouterCount,MAX_TRIES);
    int i;
    for (i=0; i < dirTriesLimit; i++) {
      OnionRouter dir=getRandomORWithFlag("String_Node_Str");
      System.out.println("String_Node_Str" + directoryType + "String_Node_Str"+ dir.name);
      try {
        return connectToDirectoryStream(dir.ip,dir.dirport,path);
      }
 catch (      IOException e) {
        System.out.println("String_Node_Str" + path + "String_Node_Str"+ directoryType+ "String_Node_Str"+ dir.ip+ "String_Node_Str"+ String.valueOf(dir.dirport));
        continue;
      }
    }
  }
  directoryType="String_Node_Str";
  int authTriesLimit=Math.min(authorities.length,MAX_TRIES);
  int tries;
  for (tries=0; tries < authTriesLimit; tries++) {
    int i=TorCrypto.rnd.nextInt(authorities.length);
    String auth=authorities[i];
    String sp[]=auth.split("String_Node_Str");
    String ipp[]=sp[3].split("String_Node_Str");
    System.out.println("String_Node_Str" + directoryType + "String_Node_Str"+ sp[0]);
    try {
      return connectToDirectoryStream(ipp[0],ipp[1],path);
    }
 catch (    IOException e) {
      System.out.println("String_Node_Str" + path + "String_Node_Str"+ directoryType+ "String_Node_Str"+ sp[0]);
      continue;
    }
  }
  throw new RuntimeException("String_Node_Str" + path + "String_Node_Str"+ String.valueOf(MAX_TRIES)+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Try random directories until we get a successful dir stream, falling back to the pre-configured authorities after MAX_TRIES, or if we don't have an existing consensus If you're having speed issues, try adding "Fast" to the lists of flags below.
 * @param path Desired dir path
 * @return InputStream for reading
 * @throws RuntimeException when it fails to download path after MAX_TRIES tries
 */
public InputStream getDirectoryStream(String path) throws RuntimeException {
  String directoryType="String_Node_Str";
  if (consensus != null && !useOnlyAuthorities) {
    int dirRouterCount=getORsWithFlag("String_Node_Str").size();
    int dirTriesLimit=Math.min(dirRouterCount,MAX_TRIES);
    int i;
    for (i=0; i < dirTriesLimit; i++) {
      OnionRouter dir=getRandomORWithFlag("String_Node_Str");
      System.out.println("String_Node_Str" + directoryType + "String_Node_Str"+ dir.name);
      try {
        return connectToDirectoryStream(dir.ip,dir.dirport,path);
      }
 catch (      IOException e) {
        System.out.println("String_Node_Str" + path + "String_Node_Str"+ directoryType+ "String_Node_Str"+ dir.ip+ "String_Node_Str"+ String.valueOf(dir.dirport));
        continue;
      }
    }
  }
  directoryType="String_Node_Str";
  int authTriesLimit=Math.min(authorities.length,MAX_TRIES);
  int tries;
  for (tries=0; tries < authTriesLimit; tries++) {
    int i=TorCrypto.rnd.nextInt(authorities.length);
    String auth=authorities[i];
    String sp[]=auth.split("String_Node_Str");
    String ipp[]=sp[3].split("String_Node_Str");
    System.out.println("String_Node_Str" + directoryType + "String_Node_Str"+ sp[0]);
    try {
      return connectToDirectoryStream(ipp[0],ipp[1],path);
    }
 catch (    IOException e) {
      System.out.println("String_Node_Str" + path + "String_Node_Str"+ directoryType+ "String_Node_Str"+ sp[0]);
      continue;
    }
  }
  throw new RuntimeException("String_Node_Str" + path + "String_Node_Str"+ String.valueOf(MAX_TRIES)+ "String_Node_Str");
}