Program: 171284
Project: 171284
Buggy source:
public static void exportGame(String exportFileName,boolean allowOverwrite){
  File dir=new File("String_Node_Str");
  dir.mkdir();
  dir=new File("String_Node_Str");
  dir.mkdir();
  boolean overwrite=false;
  if (dir.isDirectory()) {
    File[] directoryListing=dir.listFiles((path,filename) -> filename.endsWith("String_Node_Str"));
    if (directoryListing != null) {
      for (      File child : directoryListing) {
        if (child.getName().equals(exportFileName + "String_Node_Str")) {
          if (!allowOverwrite) {
            Main.game.flashMessage(Colour.GENERIC_BAD,"String_Node_Str");
            return;
          }
 else {
            overwrite=true;
          }
        }
      }
    }
  }
  try {
    if (timeLog) {
      timeStart=System.nanoTime();
      System.out.println(timeStart);
    }
    DocumentBuilderFactory docFactory=DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder=docFactory.newDocumentBuilder();
    Document doc=docBuilder.newDocument();
    Element game=doc.createElement("String_Node_Str");
    doc.appendChild(game);
    Element informationNode=doc.createElement("String_Node_Str");
    game.appendChild(informationNode);
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",Main.VERSION_NUMBER);
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",String.valueOf(Main.game.minutesPassed));
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",String.valueOf(Main.game.debugMode));
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",String.valueOf(Main.game.imperialMeasurements));
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",Main.game.currentWeather.toString());
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",String.valueOf(Main.game.nextStormTime));
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",String.valueOf(Main.game.weatherTimeRemaining));
    Element dateNode=doc.createElement("String_Node_Str");
    informationNode.appendChild(dateNode);
    CharacterUtils.addAttribute(doc,dateNode,"String_Node_Str",String.valueOf(Main.game.startingDate.getYear()));
    CharacterUtils.addAttribute(doc,dateNode,"String_Node_Str",String.valueOf(Main.game.startingDate.getMonthValue()));
    CharacterUtils.addAttribute(doc,dateNode,"String_Node_Str",String.valueOf(Main.game.startingDate.getDayOfMonth()));
    CharacterUtils.addAttribute(doc,dateNode,"String_Node_Str",String.valueOf(Main.game.startingDate.getHour()));
    CharacterUtils.addAttribute(doc,dateNode,"String_Node_Str",String.valueOf(Main.game.startingDate.getMinute()));
    Main.game.dialogueFlags.saveAsXML(game,doc);
    Element eventLogNode=doc.createElement("String_Node_Str");
    game.appendChild(eventLogNode);
    for (    EventLogEntry event : Main.game.getEventLog().subList(Math.max(0,Main.game.getEventLog().size() - 50),Main.game.getEventLog().size())) {
      event.saveAsXML(eventLogNode,doc);
    }
    Element mapNode=doc.createElement("String_Node_Str");
    game.appendChild(mapNode);
    for (    World world : Main.game.getWorlds().values()) {
      if (world != null) {
        world.saveAsXML(mapNode,doc);
      }
    }
    Element characterNode=doc.createElement("String_Node_Str");
    game.appendChild(characterNode);
    Main.game.getPlayer().saveAsXML(characterNode,doc);
    for (    GameCharacter character : Main.game.getNPCMap().values()) {
      characterNode=doc.createElement("String_Node_Str");
      game.appendChild(characterNode);
      character.saveAsXML(characterNode,doc);
    }
    TransformerFactory tf=TransformerFactory.newInstance();
    Transformer transformer1=tf.newTransformer();
    transformer1.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,"String_Node_Str");
    StringWriter writer=new StringWriter();
    transformer1.transform(new DOMSource(doc),new StreamResult(writer));
    TransformerFactory transformerFactory=TransformerFactory.newInstance();
    Transformer transformer=transformerFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT,"String_Node_Str");
    transformer.setOutputProperty("String_Node_Str","String_Node_Str");
    DOMSource source=new DOMSource(doc);
    String saveLocation="String_Node_Str" + exportFileName + "String_Node_Str";
    StreamResult result=new StreamResult(new File(saveLocation));
    transformer.transform(source,result);
    if (!exportFileName.startsWith("String_Node_Str")) {
      if (overwrite) {
        Main.game.addEvent(new EventLogEntry(Main.game.getMinutesPassed(),"String_Node_Str",saveLocation),false);
        Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()),Colour.GENERIC_GOOD,"String_Node_Str");
      }
 else {
        Main.game.addEvent(new EventLogEntry(Main.game.getMinutesPassed(),"String_Node_Str",saveLocation),false);
        Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()),Colour.GENERIC_GOOD,"String_Node_Str");
      }
    }
    if (timeLog) {
      System.out.println("String_Node_Str" + (System.nanoTime() - timeStart) / 1000000000f);
    }
  }
 catch (  ParserConfigurationException pce) {
    pce.printStackTrace();
  }
catch (  TransformerException tfe) {
    tfe.printStackTrace();
  }
}

Fixed version (ground truth):
public static void exportGame(String exportFileName,boolean allowOverwrite){
  File dir=new File("String_Node_Str");
  dir.mkdir();
  dir=new File("String_Node_Str");
  dir.mkdir();
  boolean overwrite=false;
  if (dir.isDirectory()) {
    File[] directoryListing=dir.listFiles((path,filename) -> filename.endsWith("String_Node_Str"));
    if (directoryListing != null) {
      for (      File child : directoryListing) {
        if (child.getName().equals(exportFileName + "String_Node_Str")) {
          if (!allowOverwrite) {
            Main.game.flashMessage(Colour.GENERIC_BAD,"String_Node_Str");
            return;
          }
 else {
            overwrite=true;
          }
        }
      }
    }
  }
  try {
    if (timeLog) {
      timeStart=System.nanoTime();
      System.out.println(timeStart);
    }
    DocumentBuilderFactory docFactory=DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder=docFactory.newDocumentBuilder();
    Document doc=docBuilder.newDocument();
    Element game=doc.createElement("String_Node_Str");
    doc.appendChild(game);
    Element informationNode=doc.createElement("String_Node_Str");
    game.appendChild(informationNode);
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",Main.VERSION_NUMBER);
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",String.valueOf(Main.game.minutesPassed));
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",String.valueOf(Main.game.debugMode));
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",String.valueOf(Main.game.imperialMeasurements));
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",Main.game.currentWeather.toString());
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",String.valueOf(Main.game.nextStormTime));
    CharacterUtils.addAttribute(doc,informationNode,"String_Node_Str",String.valueOf(Main.game.weatherTimeRemaining));
    Element dateNode=doc.createElement("String_Node_Str");
    informationNode.appendChild(dateNode);
    CharacterUtils.addAttribute(doc,dateNode,"String_Node_Str",String.valueOf(Main.game.startingDate.getYear()));
    CharacterUtils.addAttribute(doc,dateNode,"String_Node_Str",String.valueOf(Main.game.startingDate.getMonthValue()));
    CharacterUtils.addAttribute(doc,dateNode,"String_Node_Str",String.valueOf(Main.game.startingDate.getDayOfMonth()));
    CharacterUtils.addAttribute(doc,dateNode,"String_Node_Str",String.valueOf(Main.game.startingDate.getHour()));
    CharacterUtils.addAttribute(doc,dateNode,"String_Node_Str",String.valueOf(Main.game.startingDate.getMinute()));
    Main.game.dialogueFlags.saveAsXML(game,doc);
    Element eventLogNode=doc.createElement("String_Node_Str");
    game.appendChild(eventLogNode);
    for (    EventLogEntry event : Main.game.getEventLog().subList(Math.max(0,Main.game.getEventLog().size() - 50),Main.game.getEventLog().size())) {
      event.saveAsXML(eventLogNode,doc);
    }
    Element slaveryEventLogNode=doc.createElement("String_Node_Str");
    game.appendChild(slaveryEventLogNode);
    for (    int day : Main.game.getSlaveryEventLog().keySet()) {
      Element element=doc.createElement("String_Node_Str");
      slaveryEventLogNode.appendChild(element);
      CharacterUtils.addAttribute(doc,element,"String_Node_Str",String.valueOf(day));
      for (      SlaveryEventLogEntry event : Main.game.getSlaveryEventLog().get(day)) {
        event.saveAsXML(element,doc);
      }
    }
    Element mapNode=doc.createElement("String_Node_Str");
    game.appendChild(mapNode);
    for (    World world : Main.game.getWorlds().values()) {
      if (world != null) {
        world.saveAsXML(mapNode,doc);
      }
    }
    Element characterNode=doc.createElement("String_Node_Str");
    game.appendChild(characterNode);
    Main.game.getPlayer().saveAsXML(characterNode,doc);
    for (    GameCharacter character : Main.game.getNPCMap().values()) {
      characterNode=doc.createElement("String_Node_Str");
      game.appendChild(characterNode);
      character.saveAsXML(characterNode,doc);
    }
    TransformerFactory tf=TransformerFactory.newInstance();
    Transformer transformer1=tf.newTransformer();
    transformer1.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,"String_Node_Str");
    StringWriter writer=new StringWriter();
    transformer1.transform(new DOMSource(doc),new StreamResult(writer));
    TransformerFactory transformerFactory=TransformerFactory.newInstance();
    Transformer transformer=transformerFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT,"String_Node_Str");
    transformer.setOutputProperty("String_Node_Str","String_Node_Str");
    DOMSource source=new DOMSource(doc);
    String saveLocation="String_Node_Str" + exportFileName + "String_Node_Str";
    StreamResult result=new StreamResult(new File(saveLocation));
    transformer.transform(source,result);
    if (!exportFileName.startsWith("String_Node_Str")) {
      if (overwrite) {
        Main.game.addEvent(new EventLogEntry(Main.game.getMinutesPassed(),"String_Node_Str",saveLocation),false);
        Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()),Colour.GENERIC_GOOD,"String_Node_Str");
      }
 else {
        Main.game.addEvent(new EventLogEntry(Main.game.getMinutesPassed(),"String_Node_Str",saveLocation),false);
        Main.game.setContent(new Response("String_Node_Str","String_Node_Str",Main.game.getCurrentDialogueNode()),Colour.GENERIC_GOOD,"String_Node_Str");
      }
    }
    if (timeLog) {
      System.out.println("String_Node_Str" + (System.nanoTime() - timeStart) / 1000000000f);
    }
  }
 catch (  ParserConfigurationException pce) {
    pce.printStackTrace();
  }
catch (  TransformerException tfe) {
    tfe.printStackTrace();
  }
}