Program: 28789
Project: 28789
Buggy source:
/** 
 * This add a new page to the list of pages in the mkdocs configuration
 * @param mkdocsConfigFile           The mkdocs configuration file
 * @param documentationBaseDirectory The base directory of the documentation
 * @throws FileNotFoundException If mkdocs configuration file is not found
 */
public static void updateAPIPagesInMkdocsConfig(File mkdocsConfigFile,String documentationBaseDirectory) throws FileNotFoundException {
  File documentationDirectory=new File(documentationBaseDirectory + File.separator + Constants.API_SUB_DIRECTORY);
  String[] documentationFiles=documentationDirectory.list((directory,fileName) -> fileName.endsWith(Constants.MARKDOWN_FILE_EXTENSION));
  List<String> apiDirectoryContent;
  if (documentationFiles == null) {
    apiDirectoryContent=new ArrayList<>();
  }
 else {
    apiDirectoryContent=Arrays.asList(documentationFiles);
    apiDirectoryContent.sort(new Comparator<String>(){
      @Override public int compare(      String s1,      String s2){
        String[] s1s=s1.split("String_Node_Str");
        String[] s2s=s2.split("String_Node_Str");
        int i=0;
        while (s1s.length > i || s2s.length > i) {
          String s1a="String_Node_Str";
          String s2a="String_Node_Str";
          if (s1s.length > i) {
            s1a=s1s[i];
          }
          if (s2s.length > i) {
            s2a=s2s[i];
          }
          System.out.println(s1a + "String_Node_Str" + s2a);
          int s1aInt=Integer.parseInt(s1a);
          int s2aInt=Integer.parseInt(s2a);
          if (s2aInt > s1aInt) {
            return 1;
          }
 else           if (s2aInt < s1aInt) {
            return -1;
          }
          i++;
        }
        return 0;
      }
    }
);
  }
  String latestVersionFile=null;
  if (apiDirectoryContent.size() > 1) {
    String first=apiDirectoryContent.get(0);
    String second=apiDirectoryContent.get(1);
    if (first.equals(Constants.LATEST_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION)) {
      latestVersionFile=second;
    }
  }
  DumperOptions dumperOptions=new DumperOptions();
  dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
  Yaml yaml=new Yaml(dumperOptions);
  Map<String,Object> yamlConfig=(Map<String,Object>)yaml.load(new InputStreamReader(new FileInputStream(mkdocsConfigFile),Constants.DEFAULT_CHARSET));
  List<Map<String,Object>> yamlConfigPagesList=(List<Map<String,Object>>)yamlConfig.get(Constants.MKDOCS_CONFIG_PAGES_KEY);
  List<Map<String,Object>> apiPagesList=new ArrayList<>();
  for (  String apiFile : apiDirectoryContent) {
    String pageName=apiFile.substring(0,apiFile.length() - Constants.MARKDOWN_FILE_EXTENSION.length());
    Map<String,Object> newPage=new HashMap<>();
    if (latestVersionFile != null && pageName.equals(Constants.LATEST_FILE_NAME)) {
      pageName="String_Node_Str" + latestVersionFile.substring(0,latestVersionFile.length() - Constants.MARKDOWN_FILE_EXTENSION.length()) + "String_Node_Str";
    }
    newPage.put(pageName,Constants.API_SUB_DIRECTORY + Constants.MKDOCS_FILE_SEPARATOR + apiFile);
    apiPagesList.add(newPage);
  }
  Map<String,Object> yamlConfigAPIPage=null;
  for (  Map<String,Object> yamlConfigPage : yamlConfigPagesList) {
    if (yamlConfigPage.get(Constants.MKDOCS_CONFIG_PAGES_API_KEY) != null) {
      yamlConfigAPIPage=yamlConfigPage;
      break;
    }
  }
  if (yamlConfigAPIPage == null) {
    yamlConfigAPIPage=new HashMap<>();
    yamlConfigPagesList.add(yamlConfigAPIPage);
  }
  yamlConfigAPIPage.put(Constants.MKDOCS_CONFIG_PAGES_API_KEY,apiPagesList);
  yaml.dump(yamlConfig,new OutputStreamWriter(new FileOutputStream(mkdocsConfigFile),Constants.DEFAULT_CHARSET));
}

Fixed version (ground truth):
/** 
 * This add a new page to the list of pages in the mkdocs configuration
 * @param mkdocsConfigFile           The mkdocs configuration file
 * @param documentationBaseDirectory The base directory of the documentation
 * @throws FileNotFoundException If mkdocs configuration file is not found
 */
public static void updateAPIPagesInMkdocsConfig(File mkdocsConfigFile,String documentationBaseDirectory) throws FileNotFoundException {
  File documentationDirectory=new File(documentationBaseDirectory + File.separator + Constants.API_SUB_DIRECTORY);
  String[] documentationFiles=documentationDirectory.list((directory,fileName) -> fileName.endsWith(Constants.MARKDOWN_FILE_EXTENSION));
  List<String> apiDirectoryContent;
  if (documentationFiles == null) {
    apiDirectoryContent=new ArrayList<>();
  }
 else {
    apiDirectoryContent=Arrays.asList(documentationFiles);
    apiDirectoryContent.sort(new Comparator<String>(){
      @Override public int compare(      String s1,      String s2){
        String[] s1s=s1.split("String_Node_Str");
        String[] s2s=s2.split("String_Node_Str");
        int i=0;
        while (s1s.length > i || s2s.length > i) {
          String s1a="String_Node_Str";
          String s2a="String_Node_Str";
          if (s1s.length > i) {
            s1a=s1s[i];
          }
          if (s2s.length > i) {
            s2a=s2s[i];
          }
          int s1aInt=Integer.parseInt(s1a);
          int s2aInt=Integer.parseInt(s2a);
          if (s2aInt > s1aInt) {
            return 1;
          }
 else           if (s2aInt < s1aInt) {
            return -1;
          }
          i++;
        }
        return 0;
      }
    }
);
  }
  String latestVersionFile=null;
  if (apiDirectoryContent.size() > 1) {
    String first=apiDirectoryContent.get(0);
    String second=apiDirectoryContent.get(1);
    if (first.equals(Constants.LATEST_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION)) {
      latestVersionFile=second;
    }
  }
  DumperOptions dumperOptions=new DumperOptions();
  dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
  Yaml yaml=new Yaml(dumperOptions);
  Map<String,Object> yamlConfig=(Map<String,Object>)yaml.load(new InputStreamReader(new FileInputStream(mkdocsConfigFile),Constants.DEFAULT_CHARSET));
  List<Map<String,Object>> yamlConfigPagesList=(List<Map<String,Object>>)yamlConfig.get(Constants.MKDOCS_CONFIG_PAGES_KEY);
  List<Map<String,Object>> apiPagesList=new ArrayList<>();
  for (  String apiFile : apiDirectoryContent) {
    String pageName=apiFile.substring(0,apiFile.length() - Constants.MARKDOWN_FILE_EXTENSION.length());
    Map<String,Object> newPage=new HashMap<>();
    if (latestVersionFile != null && pageName.equals(Constants.LATEST_FILE_NAME)) {
      pageName="String_Node_Str" + latestVersionFile.substring(0,latestVersionFile.length() - Constants.MARKDOWN_FILE_EXTENSION.length()) + "String_Node_Str";
    }
    newPage.put(pageName,Constants.API_SUB_DIRECTORY + Constants.MKDOCS_FILE_SEPARATOR + apiFile);
    apiPagesList.add(newPage);
  }
  Map<String,Object> yamlConfigAPIPage=null;
  for (  Map<String,Object> yamlConfigPage : yamlConfigPagesList) {
    if (yamlConfigPage.get(Constants.MKDOCS_CONFIG_PAGES_API_KEY) != null) {
      yamlConfigAPIPage=yamlConfigPage;
      break;
    }
  }
  if (yamlConfigAPIPage == null) {
    yamlConfigAPIPage=new HashMap<>();
    yamlConfigPagesList.add(yamlConfigAPIPage);
  }
  yamlConfigAPIPage.put(Constants.MKDOCS_CONFIG_PAGES_API_KEY,apiPagesList);
  yaml.dump(yamlConfig,new OutputStreamWriter(new FileOutputStream(mkdocsConfigFile),Constants.DEFAULT_CHARSET));
}