Program: 1637
Project: 1637
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()) {
    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);
  }
}

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=true;
    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;
    }
    double xR=0, zR=0, xO=0, zO=0;
    if (var.useChunks) {
      xR=var.xRange;
      xR=xR / 16;
      xR=Math.ceil(xR);
      xR=xR * 16;
      zR=var.zRange;
      zR=zR / 16;
      zR=Math.ceil(zR);
      zR=zR * 16;
      xO=var.xOffset;
      xO=xO / 16;
      xO=Math.round(xO);
      xO=xO * 16;
      zO=var.zOffset;
      zO=zO / 16;
      zO=Math.round(zO);
      zO=zO * 16;
    }
 else {
      xR=var.xRange;
      xR=xR / 512;
      xR=Math.ceil(xR);
      xR=xR * 512;
      zR=var.zRange;
      zR=zR / 512;
      zR=Math.ceil(zR);
      zR=zR * 512;
      xO=var.xOffset;
      xO=xO / 512;
      xO=Math.round(xO);
      xO=xO * 512;
      zO=var.zOffset;
      zO=zO / 512;
      zO=Math.round(zO);
      zO=zO * 512;
    }
    var.xRange=(int)Math.ceil(xR);
    var.zRange=(int)Math.ceil(zR);
    var.xOffset=(int)Math.ceil(xO);
    var.zOffset=(int)Math.ceil(zO);
    if (overridden) {
      Out.out("String_Node_Str" + var.xOffset + "String_Node_Str"+ var.zOffset+ "String_Node_Str");
    }
 else {
      Out.out("String_Node_Str" + var.xOffset + "String_Node_Str"+ var.zOffset+ "String_Node_Str");
    }
    Out.out("String_Node_Str");
    double xLoops, zLoops;
    long curXloops=0;
    long curZloops=0;
    double xRangeAdj=0;
    double zRangeAdj=0;
    xRangeAdj=var.xRange - var.incrementFull;
    xRangeAdj=xRangeAdj / var.increment;
    xRangeAdj=Math.ceil(xRangeAdj);
    xRangeAdj=xRangeAdj + 1;
    xRangeAdj=xRangeAdj * var.increment;
    double inc=var.increment * 2;
    xLoops=(var.xRange - var.incrementFull) / inc;
    xLoops=Math.ceil(xLoops);
    xLoops=xLoops + xLoops + 1;
    zRangeAdj=var.zRange - var.incrementFull;
    zRangeAdj=zRangeAdj / var.increment;
    zRangeAdj=Math.ceil(zRangeAdj);
    zRangeAdj=zRangeAdj + 1;
    zRangeAdj=zRangeAdj * var.increment;
    zLoops=(var.zRange - var.incrementFull) / inc;
    zLoops=Math.ceil(zLoops);
    zLoops=zLoops + zLoops + 1;
    Out.out("String_Node_Str");
    long totalIterations=(long)(xLoops * zLoops);
    Out.out("String_Node_Str" + totalIterations);
    if (totalIterations > Integer.MAX_VALUE) {
      Out.err("String_Node_Str");
      backupLevel.delete();
      Out.out("String_Node_Str");
      System.exit(0);
    }
    long currentIteration=0;
    long differenceTime=System.currentTimeMillis();
    Long timeTracking=0L;
    ArrayList<Coordinates> launchList=new ArrayList<>(0);
    try {
      launchList=new ArrayList<>((int)totalIterations);
    }
 catch (    Exception e1) {
      e1.printStackTrace();
      Out.err("String_Node_Str");
      backupLevel.delete();
      Out.out("String_Node_Str");
      System.exit(0);
    }
    for (long 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 (long 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;
        }
{
          if (currentIteration % 10000000 == 0) {
            String percentDone=Double.toString((((double)currentIteration) / 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" + currentIteration + "String_Node_Str"+ totalIterations+ "String_Node_Str"+ percentDone+ "String_Node_Str");
          }
          final Coordinates tempCoords=new Coordinates((int)currentX + var.xOffset,64,(int)currentZ + var.zOffset);
          if (var.testing) {
            System.out.println(tempCoords);
          }
        }
        if (curZloops == 1) {
          currentZ=(long)((Math.ceil((((0 - zRangeAdj) / 2) / var.increment))) * var.increment);
        }
        if (southEdgeReached) {
          currentZ=(long)zRangeAdj;
        }
      }
      curZloops=0;
      if (curXloops == 1) {
        currentX=(long)((Math.ceil((((0 - xRangeAdj) / 2) / var.increment))) * var.increment);
      }
      if (eastEdgeReached) {
        currentX=(long)xRangeAdj;
      }
    }
    String pD=Double.toString((((double)currentIteration) / totalIterations) * 100);
    final int pI=((pD.indexOf("String_Node_Str") + 3) > pD.length()) ? pD.length() : (pD.indexOf("String_Node_Str") + 3);
    pD=pD.substring(0,(pD.indexOf("String_Node_Str") == -1 ? pD.length() : pI));
    Out.out("String_Node_Str" + currentIteration + "String_Node_Str"+ totalIterations+ "String_Node_Str"+ pD+ "String_Node_Str");
    final ArrayList<Coordinates> removeList=FileRead.readArrayListCoordLog(var.worldPath + var.fileSeparator + var.logFile);
    Out.out("String_Node_Str");
    if (!(removeList.isEmpty())) {
      Arraylist.arrayListRemove(launchList,removeList);
    }
    removeList.clear();
    System.gc();
    currentIteration=0;
    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);
  }
}