Program: 69377
Project: 69377
Buggy source:
/** 
 * @param ores
 * @return a wiki loaded from cache or the fileSystem
 */
public Wiki getOrLoadWiki(final OLATResourceable ores){
  final String wikiKey=OresHelper.createStringRepresenting(ores);
  if (wikiCache == null) {
    wikiCache=coordinator.getCoordinator().getCacher().getCache(WikiManager.class.getSimpleName(),"String_Node_Str");
  }
  Wiki wiki=wikiCache.get(wikiKey);
  if (wiki != null) {
    log.debug("String_Node_Str" + ores.getResourceableId());
    return wiki;
  }
  coordinator.getCoordinator().getSyncer().doInSync(ores,new SyncerExecutor(){
    public void execute(){
      long start=0;
      if (log.isDebug()) {
        log.debug("String_Node_Str" + ores.getResourceableId());
        start=System.currentTimeMillis();
      }
      Wiki wiki=null;
      VFSContainer folder=getWikiContainer(ores,WIKI_RESOURCE_FOLDER_NAME);
      if (folder == null) {
        createFolders(ores);
        folder=getWikiContainer(ores,WIKI_RESOURCE_FOLDER_NAME);
      }
      wiki=new Wiki(getWikiRootContainer(ores));
      List<VFSItem> wikiLeaves=folder.getItems(new VFSItemSuffixFilter(new String[]{WikiManager.WIKI_PROPERTIES_SUFFIX}));
      for (Iterator<VFSItem> iter=wikiLeaves.iterator(); iter.hasNext(); ) {
        VFSLeaf propertiesFile=(VFSLeaf)iter.next();
        WikiPage page=Wiki.assignPropertiesToPage(propertiesFile);
        if (page == null) {
          String contentFileToBeDeleted=(propertiesFile.getName().substring(0,propertiesFile.getName().length() - WikiManager.WIKI_PROPERTIES_SUFFIX.length()) + WikiManager.WIKI_FILE_SUFFIX);
          folder.resolve(contentFileToBeDeleted).delete();
          propertiesFile.delete();
          continue;
        }
        if (page.getPageName().equals(WikiPage.WIKI_INDEX_PAGE) || page.getPageName().equals(WikiPage.WIKI_MENU_PAGE)) {
          VFSLeaf leaf=(VFSLeaf)folder.resolve(page.getPageId() + "String_Node_Str" + WikiManager.WIKI_FILE_SUFFIX);
          page.setContent(FileUtils.load(leaf.getInputStream(),"String_Node_Str"));
        }
        String idOutOfFileName=propertiesFile.getName().substring(0,propertiesFile.getName().indexOf("String_Node_Str"));
        if (!page.getPageId().equals(idOutOfFileName)) {
          propertiesFile.rename(page.getPageId() + "String_Node_Str" + WikiManager.WIKI_PROPERTIES_SUFFIX);
          VFSLeaf contentFile=(VFSLeaf)folder.resolve(idOutOfFileName + "String_Node_Str" + WikiManager.WIKI_FILE_SUFFIX);
          contentFile.rename(page.getPageId() + "String_Node_Str" + WikiManager.WIKI_FILE_SUFFIX);
        }
        wiki.addPage(page);
      }
      if (wiki.getNumberOfPages() == 0) {
        WikiPage indexPage=new WikiPage(WikiPage.WIKI_INDEX_PAGE);
        WikiPage menuPage=new WikiPage(WikiPage.WIKI_MENU_PAGE);
        indexPage.setCreationTime(System.currentTimeMillis());
        wiki.addPage(indexPage);
        menuPage.setCreationTime(System.currentTimeMillis());
        menuPage.setContent("String_Node_Str");
        wiki.addPage(menuPage);
        saveWikiPage(ores,indexPage,false,wiki);
        saveWikiPage(ores,menuPage,false,wiki);
      }
      WikiPage recentChangesPage=new WikiPage(WikiPage.WIKI_RECENT_CHANGES_PAGE);
      WikiPage a2zPage=new WikiPage(WikiPage.WIKI_A2Z_PAGE);
      wiki.addPage(recentChangesPage);
      wiki.addPage(a2zPage);
      if (log.isDebug()) {
        long stop=System.currentTimeMillis();
        log.debug("String_Node_Str" + (stop - start));
      }
      wikiCache.put(wikiKey,wiki);
    }
  }
);
  return wikiCache.get(wikiKey);
}

Fixed version (ground truth):
/** 
 * @param ores
 * @return a wiki loaded from cache or the fileSystem
 */
public Wiki getOrLoadWiki(final OLATResourceable ores){
  final String wikiKey=OresHelper.createStringRepresenting(ores);
  if (wikiCache == null) {
    wikiCache=coordinator.getCoordinator().getCacher().getCache(WikiManager.class.getSimpleName(),"String_Node_Str");
  }
  return wikiCache.computeIfAbsent(wikiKey,(key) -> {
    long start=0;
    if (log.isDebug()) {
      log.debug("String_Node_Str" + ores.getResourceableId());
      start=System.currentTimeMillis();
    }
    VFSContainer folder=getWikiContainer(ores,WIKI_RESOURCE_FOLDER_NAME);
    if (folder == null) {
      createFolders(ores);
      folder=getWikiContainer(ores,WIKI_RESOURCE_FOLDER_NAME);
    }
    Wiki wiki=new Wiki(getWikiRootContainer(ores));
    List<VFSItem> wikiLeaves=folder.getItems(new VFSItemSuffixFilter(new String[]{WikiManager.WIKI_PROPERTIES_SUFFIX}));
    for (Iterator<VFSItem> iter=wikiLeaves.iterator(); iter.hasNext(); ) {
      VFSLeaf propertiesFile=(VFSLeaf)iter.next();
      WikiPage page=Wiki.assignPropertiesToPage(propertiesFile);
      if (page == null) {
        String contentFileToBeDeleted=(propertiesFile.getName().substring(0,propertiesFile.getName().length() - WikiManager.WIKI_PROPERTIES_SUFFIX.length()) + WikiManager.WIKI_FILE_SUFFIX);
        folder.resolve(contentFileToBeDeleted).delete();
        propertiesFile.delete();
        continue;
      }
      if (page.getPageName().equals(WikiPage.WIKI_INDEX_PAGE) || page.getPageName().equals(WikiPage.WIKI_MENU_PAGE)) {
        VFSLeaf leaf=(VFSLeaf)folder.resolve(page.getPageId() + "String_Node_Str" + WikiManager.WIKI_FILE_SUFFIX);
        page.setContent(FileUtils.load(leaf.getInputStream(),"String_Node_Str"));
      }
      String idOutOfFileName=propertiesFile.getName().substring(0,propertiesFile.getName().indexOf("String_Node_Str"));
      if (!page.getPageId().equals(idOutOfFileName)) {
        propertiesFile.rename(page.getPageId() + "String_Node_Str" + WikiManager.WIKI_PROPERTIES_SUFFIX);
        VFSLeaf contentFile=(VFSLeaf)folder.resolve(idOutOfFileName + "String_Node_Str" + WikiManager.WIKI_FILE_SUFFIX);
        contentFile.rename(page.getPageId() + "String_Node_Str" + WikiManager.WIKI_FILE_SUFFIX);
      }
      wiki.addPage(page);
    }
    if (wiki.getNumberOfPages() == 0) {
      WikiPage indexPage=new WikiPage(WikiPage.WIKI_INDEX_PAGE);
      WikiPage menuPage=new WikiPage(WikiPage.WIKI_MENU_PAGE);
      indexPage.setCreationTime(System.currentTimeMillis());
      wiki.addPage(indexPage);
      menuPage.setCreationTime(System.currentTimeMillis());
      menuPage.setContent("String_Node_Str");
      wiki.addPage(menuPage);
      saveWikiPage(ores,indexPage,false,wiki);
      saveWikiPage(ores,menuPage,false,wiki);
    }
    WikiPage recentChangesPage=new WikiPage(WikiPage.WIKI_RECENT_CHANGES_PAGE);
    WikiPage a2zPage=new WikiPage(WikiPage.WIKI_A2Z_PAGE);
    wiki.addPage(recentChangesPage);
    wiki.addPage(a2zPage);
    if (log.isDebug()) {
      long stop=System.currentTimeMillis();
      log.debug("String_Node_Str" + (stop - start));
    }
    return wiki;
  }
);
}