Program: 1641
Project: 1641
Buggy source:
/** 
 * Start MinecraftLandGenerator (Command Line Interface)
 * @author Corrodias, Morlok8k
 * @param args
 */
private static void runCLI(){
  final File backupLevel;
  final File serverLevel;
  Startup.initialStart();
  if (Startup.programArguments()) {
    return;
  }
  if (Startup.confFile()) {
    return;
  }
  try {
    if (Setup.doSetup()) {
      return;
    }
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
  Out.out("String_Node_Str" + var.worldPath + "String_Node_Str"+ var.increment+ "String_Node_Str"+ var.javaLine);
  Out.out("String_Node_Str");
  try {
    final long generationStartTimeTracking=System.currentTimeMillis();
    if ((var.xRange == 0) & (var.zRange == 0)) {
      return;
    }
    FileWrite.AppendTxtFile(var.worldPath + var.fileSeparator + var.logFile,"String_Node_Str" + var.PROG_NAME + "String_Node_Str"+ var.VERSION+ "String_Node_Str"+ SelfAware.JVMinfo()+ var.newLine+ "String_Node_Str"+ var.MC_Server_Version+ var.newLine+ "String_Node_Str"+ var.dateFormat.format(generationStartTimeTracking)+ var.newLine+ "String_Node_Str"+ var.xRange+ "String_Node_Str"+ var.zRange+ var.newLine);
    Out.out("String_Node_Str");
    serverLevel=new File(var.worldPath + var.fileSeparator + "String_Node_Str");
    backupLevel=new File(var.worldPath + var.fileSeparator + "String_Node_Str");
    Out.out("String_Node_Str");
    Misc.copyFile(serverLevel,backupLevel);
    Out.out("String_Node_Str");
    final Coordinates spawn=SpawnPoint.getSpawn(serverLevel);
    Out.out("String_Node_Str" + spawn);
    FileWrite.AppendTxtFile(var.worldPath + var.fileSeparator + var.logFile,"String_Node_Str" + var.randomSeed + var.newLine+ "String_Node_Str"+ spawn.toString()+ var.newLine);
    boolean overridden=false;
    if (var.xOffset == null) {
      var.xOffset=spawn.getX();
    }
 else {
      overridden=true;
    }
    if (var.zOffset == null) {
      var.zOffset=spawn.getZ();
    }
 else {
      overridden=true;
    }
    if (var.useChunks) {
      var.xRange=(int)(Math.ceil(((double)var.xRange) / ((double)16))) * 16;
      var.zRange=(int)(Math.ceil(((double)var.zRange) / ((double)16))) * 16;
      var.xOffset=(int)(Math.ceil(((double)var.xOffset) / ((double)16))) * 16;
      var.zOffset=(int)(Math.ceil(((double)var.zOffset) / ((double)16))) * 16;
    }
 else {
      var.xRange=(int)(Math.ceil(((double)var.xRange) / ((double)512))) * 512;
      var.zRange=(int)(Math.ceil(((double)var.zRange) / ((double)512))) * 512;
      var.xOffset=(int)(Math.ceil(((double)var.xOffset) / ((double)512))) * 512;
      var.zOffset=(int)(Math.ceil(((double)var.zOffset) / ((double)512))) * 512;
    }
    if (overridden) {
      Out.out("String_Node_Str" + var.xOffset + "String_Node_Str"+ var.zOffset+ "String_Node_Str");
    }
    Out.out("String_Node_Str");
    double xLoops, zLoops;
    int curXloops=0;
    int curZloops=0;
    int xRangeAdj=0;
    int zRangeAdj=0;
    xLoops=((double)var.xRange / (double)var.increment);
    xLoops=Math.ceil(xLoops);
    xRangeAdj=(int)(xLoops * var.increment);
    xLoops=xLoops + 1;
    zLoops=((double)var.zRange / (double)var.increment);
    zLoops=Math.ceil(zLoops);
    zRangeAdj=(int)(zLoops * var.increment);
    zLoops=zLoops + 1;
    Out.out("String_Node_Str");
    int totalIterations=(int)(xLoops * zLoops);
    int currentIteration=0;
    long differenceTime=System.currentTimeMillis();
    Long timeTracking=0L;
    final ArrayList<Coordinates> launchList=new ArrayList<Coordinates>(totalIterations);
    for (int currentX=0; currentX <= (xRangeAdj / 2); currentX+=var.increment) {
      curXloops++;
      boolean eastEdgeReached=false;
      if (curXloops == 1) {
        currentX=(((0 - var.xRange) / 2) + (var.incrementFull / 2));
      }
 else       if (currentX >= ((xRangeAdj / 2) - (var.increment / 2))) {
        currentX=((var.xRange / 2) - (var.incrementFull / 2));
        eastEdgeReached=true;
      }
      for (int currentZ=0; currentZ <= (zRangeAdj / 2); currentZ+=var.increment) {
        currentIteration++;
        curZloops++;
        boolean southEdgeReached=false;
        if (curZloops == 1) {
          currentZ=(((0 - var.zRange) / 2) + (var.incrementFull / 2));
        }
 else         if (currentZ >= ((zRangeAdj / 2) - (var.increment / 2))) {
          currentZ=((var.zRange / 2) - (var.incrementFull / 2));
          southEdgeReached=true;
        }
{
          final Coordinates tempCoords=new Coordinates(currentX + var.xOffset,64,currentZ + var.zOffset);
          launchList.add(tempCoords);
          if (var.testing) {
            System.out.println(tempCoords);
          }
        }
        if (curZloops == 1) {
          currentZ=(int)((Math.ceil((((0 - zRangeAdj) / 2) / var.increment))) * var.increment);
        }
        if (southEdgeReached) {
          currentZ=zRangeAdj;
        }
      }
      curZloops=0;
      if (curXloops == 1) {
        currentX=(int)((Math.ceil((((0 - xRangeAdj) / 2) / var.increment))) * var.increment);
      }
      if (eastEdgeReached) {
        currentX=xRangeAdj;
      }
    }
    final ArrayList<Coordinates> removeList=FileRead.readArrayListCoordLog(var.worldPath + var.fileSeparator + var.logFile);
    if (!(removeList.isEmpty())) {
      Arraylist.arrayListRemove(launchList,removeList);
    }
    removeList.clear();
    System.gc();
    currentIteration=0;
    totalIterations=launchList.size();
    Coordinates xyz=null;
    final Iterator<Coordinates> coordArrayIterator=launchList.iterator();
    while (coordArrayIterator.hasNext()) {
      currentIteration++;
      xyz=coordArrayIterator.next();
      String percentDone=Double.toString((((double)currentIteration - 1) / totalIterations) * 100);
      final int percentIndex=((percentDone.indexOf("String_Node_Str") + 3) > percentDone.length()) ? percentDone.length() : (percentDone.indexOf("String_Node_Str") + 3);
      percentDone=percentDone.substring(0,(percentDone.indexOf("String_Node_Str") == -1 ? percentDone.length() : percentIndex));
      Out.out("String_Node_Str" + xyz + "String_Node_Str"+ currentIteration+ "String_Node_Str"+ totalIterations+ "String_Node_Str"+ percentDone+ "String_Node_Str");
      timeTracking=System.currentTimeMillis();
      differenceTime=(timeTracking - generationStartTimeTracking) / (currentIteration + 1);
      differenceTime*=1 + (totalIterations - currentIteration);
      Out.out("String_Node_Str" + Time.displayTime(differenceTime));
      SpawnPoint.setSpawn(serverLevel,xyz);
      boolean serverSuccess=false;
      serverSuccess=Server.runMinecraft();
      Out.out("String_Node_Str");
      if (serverSuccess) {
        FileWrite.AppendTxtFile(var.worldPath + var.fileSeparator + var.logFile,xyz.toString() + var.newLine);
      }
 else {
        System.exit(1);
      }
    }
    if (currentIteration == 0) {
      Out.out("String_Node_Str");
    }
 else {
      Out.out("String_Node_Str");
    }
    Misc.copyFile(backupLevel,serverLevel);
    backupLevel.delete();
    Out.out("String_Node_Str");
    Out.out("String_Node_Str" + Time.displayTime(var.startTime,System.currentTimeMillis()));
    Time.waitTenSec(false);
    if (var.webLaunch) {
      if (java.awt.GraphicsEnvironment.isHeadless()) {
        var.webLaunch=false;
      }
      final File web1=new File("String_Node_Str");
      final File web2=new File("String_Node_Str");
      final File web3=new File("String_Node_Str");
      if (web2.exists() || (web1.exists() || web3.exists())) {
        var.webLaunch=false;
      }
    }
    if (var.webLaunch && java.awt.Desktop.isDesktopSupported()) {
      final URI splashPage=URI.create("String_Node_Str");
      try {
        java.awt.Desktop.getDesktop().browse(splashPage);
      }
 catch (      final IOException e) {
        Out.err("String_Node_Str" + e.getLocalizedMessage());
      }
    }
 else {
      Out.out("String_Node_Str");
      Out.out("String_Node_Str" + var.WEBSITE);
      Out.out("String_Node_Str");
    }
  }
 catch (  final IOException ex) {
    Logger.getLogger(Main.class.getName()).log(Level.SEVERE,ex.getMessage(),ex);
  }
}

Fixed version (ground truth):
/** 
 * Start MinecraftLandGenerator (Command Line Interface)
 * @author Corrodias, Morlok8k
 * @param args
 */
private static void runCLI(){
  final File backupLevel;
  final File serverLevel;
  Startup.initialStart();
  if (Startup.programArguments()) {
    Out.err("String_Node_Str");
    return;
  }
  if (Startup.confFile()) {
    Out.err("String_Node_Str");
    return;
  }
  try {
    if (Setup.doSetup()) {
      Out.err("String_Node_Str");
      return;
    }
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
  Out.out("String_Node_Str" + var.worldPath + "String_Node_Str"+ var.increment+ "String_Node_Str"+ var.javaLine);
  Out.out("String_Node_Str");
  try {
    final long generationStartTimeTracking=System.currentTimeMillis();
    final boolean serverLaunch=Server.runMinecraft();
    if (!(serverLaunch)) {
      System.exit(1);
    }
    if ((var.xRange == 0) & (var.zRange == 0)) {
      return;
    }
    FileWrite.AppendTxtFile(var.worldPath + var.fileSeparator + var.logFile,"String_Node_Str" + var.PROG_NAME + "String_Node_Str"+ var.VERSION+ "String_Node_Str"+ SelfAware.JVMinfo()+ var.newLine+ "String_Node_Str"+ var.MC_Server_Version+ var.newLine+ "String_Node_Str"+ var.dateFormat.format(generationStartTimeTracking)+ var.newLine+ "String_Node_Str"+ var.xRange+ "String_Node_Str"+ var.zRange+ var.newLine);
    Out.out("String_Node_Str");
    serverLevel=new File(var.worldPath + var.fileSeparator + "String_Node_Str");
    backupLevel=new File(var.worldPath + var.fileSeparator + "String_Node_Str");
    Out.out("String_Node_Str");
    Misc.copyFile(serverLevel,backupLevel);
    Out.out("String_Node_Str");
    final Coordinates spawn=SpawnPoint.getSpawn(serverLevel);
    Out.out("String_Node_Str" + spawn);
    FileWrite.AppendTxtFile(var.worldPath + var.fileSeparator + var.logFile,"String_Node_Str" + var.randomSeed + var.newLine+ "String_Node_Str"+ spawn.toString()+ var.newLine);
    boolean overridden=false;
    if (var.xOffset == null) {
      var.xOffset=spawn.getX();
    }
 else {
      overridden=true;
    }
    if (var.zOffset == null) {
      var.zOffset=spawn.getZ();
    }
 else {
      overridden=true;
    }
    if (var.useChunks) {
      var.xRange=(int)(Math.ceil(((double)var.xRange) / ((double)16))) * 16;
      var.zRange=(int)(Math.ceil(((double)var.zRange) / ((double)16))) * 16;
      var.xOffset=(int)(Math.ceil(((double)var.xOffset) / ((double)16))) * 16;
      var.zOffset=(int)(Math.ceil(((double)var.zOffset) / ((double)16))) * 16;
    }
 else {
      var.xRange=(int)(Math.ceil(((double)var.xRange) / ((double)512))) * 512;
      var.zRange=(int)(Math.ceil(((double)var.zRange) / ((double)512))) * 512;
      var.xOffset=(int)(Math.ceil(((double)var.xOffset) / ((double)512))) * 512;
      var.zOffset=(int)(Math.ceil(((double)var.zOffset) / ((double)512))) * 512;
    }
    if (overridden) {
      Out.out("String_Node_Str" + var.xOffset + "String_Node_Str"+ var.zOffset+ "String_Node_Str");
    }
    Out.out("String_Node_Str");
    double xLoops, zLoops;
    int curXloops=0;
    int curZloops=0;
    int xRangeAdj=0;
    int zRangeAdj=0;
    xLoops=((double)var.xRange / (double)var.increment);
    xLoops=Math.ceil(xLoops);
    xRangeAdj=(int)(xLoops * var.increment);
    xLoops=xLoops + 1;
    zLoops=((double)var.zRange / (double)var.increment);
    zLoops=Math.ceil(zLoops);
    zRangeAdj=(int)(zLoops * var.increment);
    zLoops=zLoops + 1;
    Out.out("String_Node_Str");
    int totalIterations=(int)(xLoops * zLoops);
    int currentIteration=0;
    long differenceTime=System.currentTimeMillis();
    Long timeTracking=0L;
    final ArrayList<Coordinates> launchList=new ArrayList<Coordinates>(totalIterations);
    for (int currentX=0; currentX <= (xRangeAdj / 2); currentX+=var.increment) {
      curXloops++;
      boolean eastEdgeReached=false;
      if (curXloops == 1) {
        currentX=(((0 - var.xRange) / 2) + (var.incrementFull / 2));
      }
 else       if (currentX >= ((xRangeAdj / 2) - (var.increment / 2))) {
        currentX=((var.xRange / 2) - (var.incrementFull / 2));
        eastEdgeReached=true;
      }
      for (int currentZ=0; currentZ <= (zRangeAdj / 2); currentZ+=var.increment) {
        currentIteration++;
        curZloops++;
        boolean southEdgeReached=false;
        if (curZloops == 1) {
          currentZ=(((0 - var.zRange) / 2) + (var.incrementFull / 2));
        }
 else         if (currentZ >= ((zRangeAdj / 2) - (var.increment / 2))) {
          currentZ=((var.zRange / 2) - (var.incrementFull / 2));
          southEdgeReached=true;
        }
{
          final Coordinates tempCoords=new Coordinates(currentX + var.xOffset,64,currentZ + var.zOffset);
          launchList.add(tempCoords);
          if (var.testing) {
            System.out.println(tempCoords);
          }
        }
        if (curZloops == 1) {
          currentZ=(int)((Math.ceil((((0 - zRangeAdj) / 2) / var.increment))) * var.increment);
        }
        if (southEdgeReached) {
          currentZ=zRangeAdj;
        }
      }
      curZloops=0;
      if (curXloops == 1) {
        currentX=(int)((Math.ceil((((0 - xRangeAdj) / 2) / var.increment))) * var.increment);
      }
      if (eastEdgeReached) {
        currentX=xRangeAdj;
      }
    }
    final ArrayList<Coordinates> removeList=FileRead.readArrayListCoordLog(var.worldPath + var.fileSeparator + var.logFile);
    if (!(removeList.isEmpty())) {
      Arraylist.arrayListRemove(launchList,removeList);
    }
    removeList.clear();
    System.gc();
    currentIteration=0;
    totalIterations=launchList.size();
    Coordinates xyz=null;
    final Iterator<Coordinates> coordArrayIterator=launchList.iterator();
    while (coordArrayIterator.hasNext()) {
      currentIteration++;
      xyz=coordArrayIterator.next();
      String percentDone=Double.toString((((double)currentIteration - 1) / totalIterations) * 100);
      final int percentIndex=((percentDone.indexOf("String_Node_Str") + 3) > percentDone.length()) ? percentDone.length() : (percentDone.indexOf("String_Node_Str") + 3);
      percentDone=percentDone.substring(0,(percentDone.indexOf("String_Node_Str") == -1 ? percentDone.length() : percentIndex));
      Out.out("String_Node_Str" + xyz + "String_Node_Str"+ currentIteration+ "String_Node_Str"+ totalIterations+ "String_Node_Str"+ percentDone+ "String_Node_Str");
      timeTracking=System.currentTimeMillis();
      differenceTime=(timeTracking - generationStartTimeTracking) / (currentIteration + 1);
      differenceTime*=1 + (totalIterations - currentIteration);
      Out.out("String_Node_Str" + Time.displayTime(differenceTime));
      SpawnPoint.setSpawn(serverLevel,xyz);
      boolean serverSuccess=false;
      serverSuccess=Server.runMinecraft();
      Out.out("String_Node_Str");
      if (serverSuccess) {
        FileWrite.AppendTxtFile(var.worldPath + var.fileSeparator + var.logFile,xyz.toString() + var.newLine);
      }
 else {
        System.exit(1);
      }
    }
    if (currentIteration == 0) {
      Out.out("String_Node_Str");
    }
 else {
      Out.out("String_Node_Str");
    }
    Misc.copyFile(backupLevel,serverLevel);
    backupLevel.delete();
    Out.out("String_Node_Str");
    Out.out("String_Node_Str" + Time.displayTime(var.startTime,System.currentTimeMillis()));
    Time.waitTenSec(false);
    if (var.webLaunch) {
      if (java.awt.GraphicsEnvironment.isHeadless()) {
        var.webLaunch=false;
      }
      final File web1=new File("String_Node_Str");
      final File web2=new File("String_Node_Str");
      final File web3=new File("String_Node_Str");
      if (web2.exists() || (web1.exists() || web3.exists())) {
        var.webLaunch=false;
      }
    }
    if (var.webLaunch && java.awt.Desktop.isDesktopSupported()) {
      final URI splashPage=URI.create("String_Node_Str");
      try {
        java.awt.Desktop.getDesktop().browse(splashPage);
      }
 catch (      final IOException e) {
        Out.err("String_Node_Str" + e.getLocalizedMessage());
      }
    }
 else {
      Out.out("String_Node_Str");
      Out.out("String_Node_Str" + var.WEBSITE);
      Out.out("String_Node_Str");
    }
  }
 catch (  final IOException ex) {
    Logger.getLogger(Main.class.getName()).log(Level.SEVERE,ex.getMessage(),ex);
  }
}