Program: 73675
Project: 73675
Buggy source:
/** 
 * Create a directory with levels of depth and models.
 * @param levels The number of levels of depth required to be created.
 * @param models The number of models to be created in each folder created.
 * @return The parent directory path of the directories created.
 * @exception IOException Thrown if the operation failed to create the folders or the models inside them.
 */
private String createDirectory(int levels,int models) throws IOException {
  String fileName="String_Node_Str";
  String fileContent="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + XMLDBModel.DB_MODEL_ID_ATTR + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ XMLDBModel.DB_REFERENCE_ATTR+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ XMLDBModel.DB_MODEL_ID_ATTR+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ XMLDBModel.DB_REFERENCE_ATTR+ "String_Node_Str"+ "String_Node_Str";
  String directoryPath=StringUtilities.preferencesDirectory() + "String_Node_Str";
  File directory=new File(directoryPath);
  directory.mkdir();
  for (int i=0; i < models; i++) {
    FileWriter writer=new FileWriter(directoryPath + "String_Node_Str" + i+ "String_Node_Str");
    writer.write(fileContent);
    writer.flush();
    writer.close();
  }
  for (int i=0; i < levels; i++) {
    String subPath=directoryPath + "String_Node_Str" + i;
    File sub=new File(subPath);
    sub.mkdir();
    for (int j=0; j < models; j++) {
      FileWriter writer=new FileWriter(sub + "String_Node_Str" + i+ j+ "String_Node_Str");
      writer.write(fileContent);
      writer.flush();
      writer.close();
    }
  }
  return directoryPath;
}

Fixed version (ground truth):
/** 
 * Create a directory with levels of depth and models.
 * @param levels The number of levels of depth required to be created.
 * @param models The number of models to be created in each folder created.
 * @return The parent directory path of the directories created.
 * @exception IOException Thrown if the operation failed to create the folders or the models inside them.
 */
private String createDirectory(int levels,int models) throws IOException {
  String fileName="String_Node_Str";
  String fileContent="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + XMLDBModel.DB_MODEL_ID_ATTR + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ XMLDBModel.DB_REFERENCE_ATTR+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ XMLDBModel.DB_MODEL_ID_ATTR+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ XMLDBModel.DB_REFERENCE_ATTR+ "String_Node_Str"+ "String_Node_Str";
  String directoryPath=StringUtilities.preferencesDirectory() + "String_Node_Str";
  File directory=new File(directoryPath);
  if (directory.mkdir()) {
    for (int i=0; i < models; i++) {
      FileWriter writer=new FileWriter(directoryPath + "String_Node_Str" + i+ "String_Node_Str");
      try {
        writer.write(fileContent);
        writer.flush();
      }
  finally {
        writer.close();
      }
    }
    for (int i=0; i < levels; i++) {
      String subPath=directoryPath + "String_Node_Str" + i;
      File sub=new File(subPath);
      if (sub.mkdir()) {
        for (int j=0; j < models; j++) {
          FileWriter writer=new FileWriter(sub + "String_Node_Str" + i+ j+ "String_Node_Str");
          try {
            writer.write(fileContent);
            writer.flush();
          }
  finally {
            writer.close();
          }
        }
      }
    }
  }
  return directoryPath;
}