Program: 33974
Project: 33974
Buggy source:
/** 
 * Converts from the old version where islands were stored in an island folder. Did not work for large installations.
 */
private void convert(){
  final File spawnFile=new File(plugin.getDataFolder(),"String_Node_Str");
  if (spawnFile.exists()) {
    YamlConfiguration spawn=new YamlConfiguration();
    try {
      spawn.load(spawnFile);
      int range=spawn.getInt("String_Node_Str");
      Location spawnLoc=Util.getLocationString(spawn.getString("String_Node_Str","String_Node_Str"));
      if (spawnLoc != null && onGrid(spawnLoc)) {
        Island newIsland=addIsland(spawnLoc.getBlockX(),spawnLoc.getBlockZ());
        setSpawn(newIsland);
        newIsland.setProtectionSize(range);
      }
 else {
        plugin.getLogger().severe("String_Node_Str" + spawnLoc);
        plugin.getLogger().severe("String_Node_Str");
      }
    }
 catch (    Exception e) {
      plugin.getLogger().severe("String_Node_Str");
    }
  }
  final File playerFolder=new File(plugin.getDataFolder() + File.separator + "String_Node_Str");
  final File quarantineFolder=new File(plugin.getDataFolder() + File.separator + "String_Node_Str");
  YamlConfiguration playerFile=new YamlConfiguration();
  int noisland=0;
  int inTeam=0;
  int count=0;
  if (playerFolder.exists() && playerFolder.listFiles().length > 0) {
    plugin.getLogger().warning("String_Node_Str");
    if (playerFolder.listFiles().length > 5000) {
      plugin.getLogger().warning("String_Node_Str");
    }
    for (    File f : playerFolder.listFiles()) {
      String fileName=f.getName();
      if (fileName.endsWith("String_Node_Str")) {
        try {
          playerFile.load(f);
          boolean hasIsland=playerFile.getBoolean("String_Node_Str",false);
          if (hasIsland) {
            String islandLocation=playerFile.getString("String_Node_Str");
            if (islandLocation.isEmpty()) {
              plugin.getLogger().severe("String_Node_Str" + fileName);
              plugin.getLogger().severe("String_Node_Str" + playerFile.getString("String_Node_Str","String_Node_Str"));
              plugin.getLogger().severe("String_Node_Str");
              if (!quarantineFolder.exists()) {
                quarantineFolder.mkdir();
              }
              plugin.getLogger().severe("String_Node_Str" + f.getName() + "String_Node_Str"+ quarantineFolder.getName());
              File rename=new File(quarantineFolder,f.getName());
              f.renameTo(rename);
            }
 else {
              Location islandLoc=Util.getLocationString(islandLocation);
              if (islandLoc != null) {
                Island island=getIslandAt(islandLoc);
                if (island != null) {
                  plugin.getLogger().severe("String_Node_Str" + fileName);
                  plugin.getLogger().severe("String_Node_Str" + playerFile.getString("String_Node_Str","String_Node_Str"));
                  plugin.getLogger().severe("String_Node_Str");
                  if (island.getUpdatedDate() > f.lastModified()) {
                    plugin.getLogger().severe("String_Node_Str");
                    if (!quarantineFolder.exists()) {
                      quarantineFolder.mkdir();
                    }
                    plugin.getLogger().severe("String_Node_Str" + (playerFile.getString("String_Node_Str","String_Node_Str")) + "String_Node_Str"+ f.getName()+ "String_Node_Str"+ quarantineFolder.getName());
                    File rename=new File(quarantineFolder,f.getName());
                    f.renameTo(rename);
                  }
 else {
                    plugin.getLogger().severe(playerFile.getString("String_Node_Str","String_Node_Str") + "String_Node_Str");
                    File oldFile=new File(playerFolder,island.getOwner().toString() + "String_Node_Str");
                    File rename=new File(quarantineFolder,oldFile.getName());
                    if (!quarantineFolder.exists()) {
                      quarantineFolder.mkdir();
                    }
                    plugin.getLogger().severe("String_Node_Str" + oldFile.getName() + "String_Node_Str"+ quarantineFolder.getName());
                    oldFile.renameTo(rename);
                    deleteIsland(islandLoc);
                    island=null;
                  }
                }
                if (island == null) {
                  if (!onGrid(islandLoc)) {
                    plugin.getLogger().severe("String_Node_Str" + fileName);
                    plugin.getLogger().severe("String_Node_Str" + playerFile.getString("String_Node_Str","String_Node_Str"));
                    plugin.getLogger().severe("String_Node_Str" + islandLoc);
                  }
                  String ownerString=fileName.substring(0,fileName.length() - 4);
                  UUID owner=UUID.fromString(ownerString);
                  Island newIsland=addIsland(islandLoc.getBlockX(),islandLoc.getBlockZ(),owner);
                  ownershipMap.put(owner,newIsland);
                  newIsland.setUpdatedDate(f.lastModified());
                  if ((count) % 1000 == 0) {
                    plugin.getLogger().info("String_Node_Str" + count + "String_Node_Str");
                  }
                  count++;
                  int islandLevel=playerFile.getInt("String_Node_Str",0);
                  String teamLeaderUUID=playerFile.getString("String_Node_Str","String_Node_Str");
                  if (islandLevel > 0) {
                    if (!playerFile.getBoolean("String_Node_Str")) {
                      TopTen.topTenAddEntry(owner,islandLevel);
                    }
 else                     if (!teamLeaderUUID.isEmpty()) {
                      if (teamLeaderUUID.equals(ownerString)) {
                        TopTen.topTenAddEntry(owner,islandLevel);
                      }
                    }
                  }
                  String islandInfo=playerFile.getString("String_Node_Str","String_Node_Str");
                  if (!islandInfo.isEmpty()) {
                    String[] split=islandInfo.split("String_Node_Str");
                    try {
                      newIsland.setLocked(false);
                      if (split.length > 6) {
                        if (split[6].equalsIgnoreCase("String_Node_Str")) {
                          newIsland.setLocked(true);
                        }
                      }
                      newIsland.setPurgeProtected(false);
                      if (split.length > 7) {
                        if (split[7].equalsIgnoreCase("String_Node_Str")) {
                          newIsland.setPurgeProtected(true);
                        }
                      }
                      if (!split[5].equals("String_Node_Str")) {
                        if (split[5].equals("String_Node_Str")) {
                          newIsland.setSpawn(true);
                          if (split.length > 8) {
                            Location spawnPoint=Util.getLocationString(islandInfo.substring(islandInfo.indexOf("String_Node_Str") + 4));
                            newIsland.setSpawnPoint(spawnPoint);
                          }
                        }
                      }
                      if (!newIsland.isSpawn()) {
                        if (split.length > 8 && split[8].length() == 29) {
                          int index=0;
                          for (                          Flags flag : Flags.values()) {
                            newIsland.setIgsFlag(flag,split[8].charAt(index++) == '1' ? true : false);
                          }
                        }
                      }
                    }
 catch (                    Exception e) {
                      e.printStackTrace();
                    }
                  }
                }
              }
 else {
                plugin.getLogger().severe("String_Node_Str" + fileName);
                plugin.getLogger().severe("String_Node_Str" + playerFile.getString("String_Node_Str","String_Node_Str"));
                plugin.getLogger().severe("String_Node_Str");
              }
            }
          }
 else {
            noisland++;
            if (playerFile.getBoolean("String_Node_Str",false)) {
              inTeam++;
            }
          }
        }
 catch (        Exception e) {
          plugin.getLogger().severe("String_Node_Str" + fileName);
          e.printStackTrace();
        }
      }
    }
    plugin.getLogger().info("String_Node_Str" + count + "String_Node_Str");
    plugin.getLogger().info(noisland + "String_Node_Str" + inTeam+ "String_Node_Str");
    plugin.getLogger().info((noisland - inTeam) + "String_Node_Str");
  }
  TopTen.topTenSave();
  int count2=0;
  final File islandFolder=new File(plugin.getDataFolder() + File.separator + "String_Node_Str");
  if (islandFolder.exists() && islandFolder.listFiles().length > 0) {
    plugin.getLogger().warning("String_Node_Str");
    if (islandFolder.listFiles().length > 5000) {
      plugin.getLogger().warning("String_Node_Str");
    }
    for (    File f : islandFolder.listFiles()) {
      String fileName=f.getName();
      int comma=fileName.indexOf("String_Node_Str");
      if (fileName.endsWith("String_Node_Str") && comma != -1) {
        try {
          int x=Integer.parseInt(fileName.substring(0,comma));
          int z=Integer.parseInt(fileName.substring(comma + 1,fileName.indexOf("String_Node_Str")));
          if (!onGrid(x,z)) {
            plugin.getLogger().severe("String_Node_Str" + x + "String_Node_Str"+ z+ "String_Node_Str");
          }
 else {
            if (getIslandAt(x,z) == null) {
              addIsland(x,z);
              if (count2 % 1000 == 0) {
                plugin.getLogger().info("String_Node_Str" + count + "String_Node_Str");
              }
              count2++;
            }
          }
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
    }
    plugin.getLogger().info("String_Node_Str" + count2 + "String_Node_Str");
    plugin.getLogger().info("String_Node_Str" + (count + count2) + "String_Node_Str");
  }
  saveGrid();
}

Fixed version (ground truth):
/** 
 * Converts from the old version where islands were stored in an island folder. Did not work for large installations.
 */
private void convert(){
  final File spawnFile=new File(plugin.getDataFolder(),"String_Node_Str");
  if (spawnFile.exists()) {
    YamlConfiguration spawn=new YamlConfiguration();
    try {
      spawn.load(spawnFile);
      int range=spawn.getInt("String_Node_Str");
      Location spawnLoc=Util.getLocationString(spawn.getString("String_Node_Str","String_Node_Str"));
      if (spawnLoc != null && onGrid(spawnLoc)) {
        Island newIsland=addIsland(spawnLoc.getBlockX(),spawnLoc.getBlockZ());
        setSpawn(newIsland);
        newIsland.setProtectionSize(range);
      }
 else {
        plugin.getLogger().severe("String_Node_Str" + spawnLoc);
        plugin.getLogger().severe("String_Node_Str");
      }
    }
 catch (    Exception e) {
      plugin.getLogger().severe("String_Node_Str");
    }
  }
  final File playerFolder=new File(plugin.getDataFolder() + File.separator + "String_Node_Str");
  final File quarantineFolder=new File(plugin.getDataFolder() + File.separator + "String_Node_Str");
  YamlConfiguration playerFile=new YamlConfiguration();
  int noisland=0;
  int inTeam=0;
  int count=0;
  if (playerFolder.exists() && playerFolder.listFiles().length > 0) {
    plugin.getLogger().warning("String_Node_Str");
    if (playerFolder.listFiles().length > 5000) {
      plugin.getLogger().warning("String_Node_Str");
    }
    for (    File f : playerFolder.listFiles()) {
      String fileName=f.getName();
      if (fileName.endsWith("String_Node_Str")) {
        try {
          playerFile.load(f);
          boolean hasIsland=playerFile.getBoolean("String_Node_Str",false);
          if (hasIsland) {
            String islandLocation=playerFile.getString("String_Node_Str");
            if (islandLocation.isEmpty()) {
              plugin.getLogger().severe("String_Node_Str" + fileName);
              plugin.getLogger().severe("String_Node_Str" + playerFile.getString("String_Node_Str","String_Node_Str"));
              plugin.getLogger().severe("String_Node_Str");
              if (!quarantineFolder.exists()) {
                quarantineFolder.mkdir();
              }
              plugin.getLogger().severe("String_Node_Str" + f.getName() + "String_Node_Str"+ quarantineFolder.getName());
              File rename=new File(quarantineFolder,f.getName());
              f.renameTo(rename);
            }
 else {
              Location islandLoc=Util.getLocationString(islandLocation);
              if (islandLoc != null) {
                Island island=getIslandAt(islandLoc);
                if (island != null) {
                  plugin.getLogger().severe("String_Node_Str" + fileName);
                  plugin.getLogger().severe("String_Node_Str" + playerFile.getString("String_Node_Str","String_Node_Str"));
                  plugin.getLogger().severe("String_Node_Str");
                  if (island.getUpdatedDate() > f.lastModified()) {
                    plugin.getLogger().severe("String_Node_Str");
                    if (!quarantineFolder.exists()) {
                      quarantineFolder.mkdir();
                    }
                    plugin.getLogger().severe("String_Node_Str" + (playerFile.getString("String_Node_Str","String_Node_Str")) + "String_Node_Str"+ f.getName()+ "String_Node_Str"+ quarantineFolder.getName());
                    File rename=new File(quarantineFolder,f.getName());
                    f.renameTo(rename);
                  }
 else {
                    plugin.getLogger().severe(playerFile.getString("String_Node_Str","String_Node_Str") + "String_Node_Str");
                    File oldFile=new File(playerFolder,island.getOwner().toString() + "String_Node_Str");
                    File rename=new File(quarantineFolder,oldFile.getName());
                    if (!quarantineFolder.exists()) {
                      quarantineFolder.mkdir();
                    }
                    plugin.getLogger().severe("String_Node_Str" + oldFile.getName() + "String_Node_Str"+ quarantineFolder.getName());
                    oldFile.renameTo(rename);
                    deleteIsland(islandLoc);
                    island=null;
                  }
                }
                if (island == null) {
                  if (!onGrid(islandLoc)) {
                    plugin.getLogger().severe("String_Node_Str" + fileName);
                    plugin.getLogger().severe("String_Node_Str" + playerFile.getString("String_Node_Str","String_Node_Str"));
                    plugin.getLogger().severe("String_Node_Str" + islandLoc);
                  }
                  String ownerString=fileName.substring(0,fileName.length() - 4);
                  UUID owner=UUID.fromString(ownerString);
                  Island newIsland=addIsland(islandLoc.getBlockX(),islandLoc.getBlockZ(),owner);
                  ownershipMap.put(owner,newIsland);
                  newIsland.setUpdatedDate(f.lastModified());
                  if ((count) % 1000 == 0) {
                    plugin.getLogger().info("String_Node_Str" + count + "String_Node_Str");
                  }
                  count++;
                  int islandLevel=playerFile.getInt("String_Node_Str",0);
                  String teamLeaderUUID=playerFile.getString("String_Node_Str","String_Node_Str");
                  if (islandLevel > 0) {
                    if (!playerFile.getBoolean("String_Node_Str")) {
                      TopTen.topTenAddEntry(owner,islandLevel);
                    }
 else                     if (!teamLeaderUUID.isEmpty()) {
                      if (teamLeaderUUID.equals(ownerString)) {
                        TopTen.topTenAddEntry(owner,islandLevel);
                      }
                    }
                  }
                  String islandInfo=playerFile.getString("String_Node_Str","String_Node_Str");
                  if (!islandInfo.isEmpty()) {
                    String[] split=islandInfo.split("String_Node_Str");
                    try {
                      newIsland.setLocked(false);
                      if (split.length > 6) {
                        if (split[6].equalsIgnoreCase("String_Node_Str")) {
                          newIsland.setLocked(true);
                        }
                      }
                      newIsland.setPurgeProtected(false);
                      if (split.length > 7) {
                        if (split[7].equalsIgnoreCase("String_Node_Str")) {
                          newIsland.setPurgeProtected(true);
                        }
                      }
                      if (!split[5].equals("String_Node_Str")) {
                        if (split[5].equals("String_Node_Str")) {
                          newIsland.setSpawn(true);
                          if (split.length > 8) {
                            Location spawnPoint=Util.getLocationString(islandInfo.substring(islandInfo.indexOf("String_Node_Str") + 4));
                            newIsland.setSpawnPoint(spawnPoint);
                          }
                        }
                      }
                      if (!newIsland.isSpawn()) {
                        if (split.length > 8 && split[8].length() == 29) {
                          int index=0;
                          for (                          Flags flag : Flags.values()) {
                            if (index < split[8].length()) {
                              newIsland.setIgsFlag(flag,split[8].charAt(index++) == '1' ? true : false);
                            }
                          }
                        }
                      }
                    }
 catch (                    Exception e) {
                      e.printStackTrace();
                    }
                  }
                }
              }
 else {
                plugin.getLogger().severe("String_Node_Str" + fileName);
                plugin.getLogger().severe("String_Node_Str" + playerFile.getString("String_Node_Str","String_Node_Str"));
                plugin.getLogger().severe("String_Node_Str");
              }
            }
          }
 else {
            noisland++;
            if (playerFile.getBoolean("String_Node_Str",false)) {
              inTeam++;
            }
          }
        }
 catch (        Exception e) {
          plugin.getLogger().severe("String_Node_Str" + fileName);
          e.printStackTrace();
        }
      }
    }
    plugin.getLogger().info("String_Node_Str" + count + "String_Node_Str");
    plugin.getLogger().info(noisland + "String_Node_Str" + inTeam+ "String_Node_Str");
    plugin.getLogger().info((noisland - inTeam) + "String_Node_Str");
  }
  TopTen.topTenSave();
  int count2=0;
  final File islandFolder=new File(plugin.getDataFolder() + File.separator + "String_Node_Str");
  if (islandFolder.exists() && islandFolder.listFiles().length > 0) {
    plugin.getLogger().warning("String_Node_Str");
    if (islandFolder.listFiles().length > 5000) {
      plugin.getLogger().warning("String_Node_Str");
    }
    for (    File f : islandFolder.listFiles()) {
      String fileName=f.getName();
      int comma=fileName.indexOf("String_Node_Str");
      if (fileName.endsWith("String_Node_Str") && comma != -1) {
        try {
          int x=Integer.parseInt(fileName.substring(0,comma));
          int z=Integer.parseInt(fileName.substring(comma + 1,fileName.indexOf("String_Node_Str")));
          if (!onGrid(x,z)) {
            plugin.getLogger().severe("String_Node_Str" + x + "String_Node_Str"+ z+ "String_Node_Str");
          }
 else {
            if (getIslandAt(x,z) == null) {
              addIsland(x,z);
              if (count2 % 1000 == 0) {
                plugin.getLogger().info("String_Node_Str" + count + "String_Node_Str");
              }
              count2++;
            }
          }
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
    }
    plugin.getLogger().info("String_Node_Str" + count2 + "String_Node_Str");
    plugin.getLogger().info("String_Node_Str" + (count + count2) + "String_Node_Str");
  }
  saveGrid();
}