Program: 57897
Project: 57897
Buggy source:
@Override public boolean onCommand(final PlotPlayer player,String[] args){
  final UUIDWrapper currentUUIDWrapper=UUIDHandler.getUUIDWrapper();
  final UUIDWrapper newWrapper;
switch (args[0].toLowerCase()) {
case "String_Node_Str":
    newWrapper=new LowerOfflineUUIDWrapper();
  break;
case "String_Node_Str":
newWrapper=new OfflineUUIDWrapper();
break;
case "String_Node_Str":
newWrapper=new DefaultUUIDWrapper();
break;
default :
try {
Class<?> clazz=Class.forName(args[0]);
newWrapper=(UUIDWrapper)clazz.newInstance();
}
 catch (ClassNotFoundException|IllegalAccessException|InstantiationException e) {
MainUtil.sendMessage(player,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
}
if (args.length != 2 || !"String_Node_Str".equals(args[1])) {
MainUtil.sendMessage(player,C.COMMAND_SYNTAX,"String_Node_Str" + args[0] + "String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
return false;
}
if (currentUUIDWrapper.getClass().getCanonicalName().equals(newWrapper.getClass().getCanonicalName())) {
MainUtil.sendMessage(player,"String_Node_Str");
return false;
}
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
for (Entry<String,PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
entry.getValue().kick("String_Node_Str");
}
MainUtil.sendMessage(player,"String_Node_Str");
final HashMap<UUID,UUID> uCMap=new HashMap<>();
final HashMap<UUID,UUID> uCReverse=new HashMap<>();
MainUtil.sendMessage(player,"String_Node_Str");
HashSet<String> worlds=new HashSet<>();
worlds.add(WorldUtil.IMP.getMainWorld());
worlds.add("String_Node_Str");
HashSet<UUID> uuids=new HashSet<>();
HashSet<String> names=new HashSet<>();
for (String worldName : worlds) {
File playerDataFolder=new File(worldName + File.separator + "String_Node_Str");
String[] dat=playerDataFolder.list(new FilenameFilter(){
@Override public boolean accept(File f,String s){
return s.endsWith("String_Node_Str");
}
}
);
if (dat != null) {
for (String current : dat) {
String s=current.replaceAll("String_Node_Str","String_Node_Str");
try {
UUID uuid=UUID.fromString(s);
uuids.add(uuid);
}
 catch (Exception ignored) {
MainUtil.sendMessage(player,C.PREFIX + "String_Node_Str" + current);
}
}
}
File playersFolder=new File(worldName + File.separator + "String_Node_Str");
dat=playersFolder.list(new FilenameFilter(){
@Override public boolean accept(File f,String s){
return s.endsWith("String_Node_Str");
}
}
);
if (dat != null) {
for (String current : dat) {
names.add(current.replaceAll("String_Node_Str","String_Node_Str"));
}
}
}
MainUtil.sendMessage(player,"String_Node_Str");
UUID uuid2;
UUIDWrapper wrapper=new DefaultUUIDWrapper();
for (UUID uuid : uuids) {
try {
OfflinePlotPlayer op=wrapper.getOfflinePlayer(uuid);
uuid=currentUUIDWrapper.getUUID(op);
uuid2=newWrapper.getUUID(op);
if (!uuid.equals(uuid2) && !uCMap.containsKey(uuid) && !uCReverse.containsKey(uuid2)) {
uCMap.put(uuid,uuid2);
uCReverse.put(uuid2,uuid);
}
}
 catch (Throwable ignored) {
MainUtil.sendMessage(player,C.PREFIX + "String_Node_Str" + uuid.toString()+ "String_Node_Str");
}
}
for (String name : names) {
UUID uuid=currentUUIDWrapper.getUUID(name);
uuid2=newWrapper.getUUID(name);
if (!uuid.equals(uuid2)) {
uCMap.put(uuid,uuid2);
uCReverse.put(uuid2,uuid);
}
}
if (uCMap.isEmpty()) {
MainUtil.sendMessage(player,"String_Node_Str");
for (OfflinePlotPlayer op : currentUUIDWrapper.getOfflinePlayers()) {
if (op.getLastPlayed() != 0) {
UUID uuid=currentUUIDWrapper.getUUID(op);
uuid2=newWrapper.getUUID(op);
if (!uuid.equals(uuid2)) {
uCMap.put(uuid,uuid2);
uCReverse.put(uuid2,uuid);
}
}
}
if (uCMap.isEmpty()) {
MainUtil.sendMessage(player,"String_Node_Str");
return false;
}
 else {
MainUtil.sendMessage(player,"String_Node_Str");
}
}
MainUtil.sendMessage(player,"String_Node_Str");
TaskManager.runTaskAsync(new Runnable(){
@Override public void run(){
for (Entry<UUID,UUID> entry : uCMap.entrySet()) {
String name=UUIDHandler.getName(entry.getKey());
if (name != null) {
UUIDHandler.add(new StringWrapper(name),entry.getValue());
}
}
MainUtil.sendMessage(player,"String_Node_Str");
File file=new File(PS.get().IMP.getDirectory(),"String_Node_Str");
if (file.exists()) {
try {
List<String> lines=Files.readAllLines(file.toPath(),StandardCharsets.UTF_8);
for (String line : lines) {
try {
line=line.trim();
if (line.isEmpty()) {
  continue;
}
line=line.replaceAll("String_Node_Str","String_Node_Str");
String[] split=line.split("String_Node_Str");
String name=split[0];
if (name.isEmpty() || name.length() > 16 || !StringMan.isAlphanumericUnd(name)) {
  continue;
}
UUID old=currentUUIDWrapper.getUUID(name);
if (old == null) {
  continue;
}
UUID now=newWrapper.getUUID(name);
UUIDHandler.add(new StringWrapper(name),now);
uCMap.put(old,now);
uCReverse.put(now,old);
}
 catch (Exception e2) {
e2.printStackTrace();
}
}
}
 catch (IOException e) {
e.printStackTrace();
}
}
MainUtil.sendMessage(player,"String_Node_Str");
UUIDHandler.setUUIDWrapper(newWrapper);
MainUtil.sendMessage(player,"String_Node_Str");
for (Plot plot : PS.get().getPlots()) {
UUID value=uCMap.get(plot.owner);
if (value != null) {
plot.owner=value;
}
plot.getTrusted().clear();
plot.getMembers().clear();
plot.getDenied().clear();
}
MainUtil.sendMessage(player,"String_Node_Str");
final AbstractDB database=DBFunc.dbManager;
boolean result=database.deleteTables();
MainUtil.sendMessage(player,"String_Node_Str");
try {
database.createTables();
if (!result) {
MainUtil.sendMessage(player,"String_Node_Str");
for (Plot plot : PS.get().getPlots()) {
UUID value=uCReverse.get(plot.owner);
if (value != null) {
plot.owner=value;
}
}
database.createPlotsAndData(new ArrayList<>(PS.get().getPlots()),new Runnable(){
@Override public void run(){
MainUtil.sendMessage(player,"String_Node_Str");
}
}
);
return;
}
}
 catch (Exception e) {
e.printStackTrace();
return;
}
if (newWrapper instanceof OfflineUUIDWrapper) {
PS.get().config.set("String_Node_Str",false);
PS.get().config.set("String_Node_Str",true);
}
 else if (newWrapper instanceof DefaultUUIDWrapper) {
PS.get().config.set("String_Node_Str",false);
PS.get().config.set("String_Node_Str",false);
}
try {
PS.get().config.save(PS.get().configFile);
}
 catch (IOException e) {
MainUtil.sendMessage(player,"String_Node_Str");
}
MainUtil.sendMessage(player,"String_Node_Str");
TaskManager.runTaskAsync(new Runnable(){
@Override public void run(){
ArrayList<Plot> plots=new ArrayList<>(PS.get().getPlots());
database.createPlotsAndData(plots,new Runnable(){
@Override public void run(){
MainUtil.sendMessage(player,"String_Node_Str");
}
}
);
}
}
);
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
}
}
);
return true;
}

Fixed version (ground truth):
@Override public boolean onCommand(final PlotPlayer player,String[] args){
  final UUIDWrapper currentUUIDWrapper=UUIDHandler.getUUIDWrapper();
  final UUIDWrapper newWrapper;
switch (args[0].toLowerCase()) {
case "String_Node_Str":
    newWrapper=new LowerOfflineUUIDWrapper();
  break;
case "String_Node_Str":
newWrapper=new OfflineUUIDWrapper();
break;
case "String_Node_Str":
newWrapper=new DefaultUUIDWrapper();
break;
default :
try {
Class<?> clazz=Class.forName(args[0]);
newWrapper=(UUIDWrapper)clazz.newInstance();
}
 catch (ClassNotFoundException|IllegalAccessException|InstantiationException e) {
MainUtil.sendMessage(player,C.COMMAND_SYNTAX,"String_Node_Str");
return false;
}
}
if (args.length != 2 || !"String_Node_Str".equals(args[1])) {
MainUtil.sendMessage(player,C.COMMAND_SYNTAX,"String_Node_Str" + args[0] + "String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
return false;
}
if (currentUUIDWrapper.getClass().getCanonicalName().equals(newWrapper.getClass().getCanonicalName())) {
MainUtil.sendMessage(player,"String_Node_Str");
return false;
}
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
for (Entry<String,PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
entry.getValue().kick("String_Node_Str");
}
MainUtil.sendMessage(player,"String_Node_Str");
final HashMap<UUID,UUID> uCMap=new HashMap<>();
final HashMap<UUID,UUID> uCReverse=new HashMap<>();
MainUtil.sendMessage(player,"String_Node_Str");
HashSet<String> worlds=new HashSet<>();
worlds.add(WorldUtil.IMP.getMainWorld());
worlds.add("String_Node_Str");
HashSet<UUID> uuids=new HashSet<>();
HashSet<String> names=new HashSet<>();
for (String worldName : worlds) {
File playerDataFolder=new File(worldName + File.separator + "String_Node_Str");
String[] dat=playerDataFolder.list(new FilenameFilter(){
@Override public boolean accept(File f,String s){
return s.endsWith("String_Node_Str");
}
}
);
if (dat != null) {
for (String current : dat) {
String s=current.replaceAll("String_Node_Str","String_Node_Str");
try {
UUID uuid=UUID.fromString(s);
uuids.add(uuid);
}
 catch (Exception ignored) {
MainUtil.sendMessage(player,C.PREFIX + "String_Node_Str" + current);
}
}
}
File playersFolder=new File(worldName + File.separator + "String_Node_Str");
dat=playersFolder.list(new FilenameFilter(){
@Override public boolean accept(File f,String s){
return s.endsWith("String_Node_Str");
}
}
);
if (dat != null) {
for (String current : dat) {
names.add(current.replaceAll("String_Node_Str","String_Node_Str"));
}
}
}
MainUtil.sendMessage(player,"String_Node_Str");
UUID uuid2;
UUIDWrapper wrapper=new DefaultUUIDWrapper();
for (UUID uuid : uuids) {
try {
OfflinePlotPlayer op=wrapper.getOfflinePlayer(uuid);
uuid=currentUUIDWrapper.getUUID(op);
uuid2=newWrapper.getUUID(op);
if (!uuid.equals(uuid2) && !uCMap.containsKey(uuid) && !uCReverse.containsKey(uuid2)) {
uCMap.put(uuid,uuid2);
uCReverse.put(uuid2,uuid);
}
}
 catch (Throwable ignored) {
MainUtil.sendMessage(player,C.PREFIX + "String_Node_Str" + uuid.toString()+ "String_Node_Str");
}
}
for (String name : names) {
UUID uuid=currentUUIDWrapper.getUUID(name);
uuid2=newWrapper.getUUID(name);
if (!uuid.equals(uuid2)) {
uCMap.put(uuid,uuid2);
uCReverse.put(uuid2,uuid);
}
}
if (uCMap.isEmpty()) {
MainUtil.sendMessage(player,"String_Node_Str");
for (OfflinePlotPlayer op : currentUUIDWrapper.getOfflinePlayers()) {
if (op.getLastPlayed() != 0) {
UUID uuid=currentUUIDWrapper.getUUID(op);
uuid2=newWrapper.getUUID(op);
if (!uuid.equals(uuid2)) {
uCMap.put(uuid,uuid2);
uCReverse.put(uuid2,uuid);
}
}
}
if (uCMap.isEmpty()) {
MainUtil.sendMessage(player,"String_Node_Str");
return false;
}
 else {
MainUtil.sendMessage(player,"String_Node_Str");
}
}
MainUtil.sendMessage(player,"String_Node_Str");
TaskManager.runTaskAsync(new Runnable(){
@Override public void run(){
for (Entry<UUID,UUID> entry : uCMap.entrySet()) {
String name=UUIDHandler.getName(entry.getKey());
if (name != null) {
UUIDHandler.add(new StringWrapper(name),entry.getValue());
}
}
MainUtil.sendMessage(player,"String_Node_Str");
File file=new File(PS.get().IMP.getDirectory(),"String_Node_Str");
if (file.exists()) {
try {
List<String> lines=Files.readAllLines(file.toPath(),StandardCharsets.UTF_8);
for (String line : lines) {
try {
line=line.trim();
if (line.isEmpty()) {
  continue;
}
line=line.replaceAll("String_Node_Str","String_Node_Str");
String[] split=line.split("String_Node_Str");
String name=split[0];
if (name.isEmpty() || name.length() > 16 || !StringMan.isAlphanumericUnd(name)) {
  continue;
}
UUID old=currentUUIDWrapper.getUUID(name);
if (old == null) {
  continue;
}
UUID now=newWrapper.getUUID(name);
UUIDHandler.add(new StringWrapper(name),now);
uCMap.put(old,now);
uCReverse.put(now,old);
}
 catch (Exception e2) {
e2.printStackTrace();
}
}
}
 catch (IOException e) {
e.printStackTrace();
}
}
MainUtil.sendMessage(player,"String_Node_Str");
UUIDHandler.setUUIDWrapper(newWrapper);
MainUtil.sendMessage(player,"String_Node_Str");
for (Plot plot : PS.get().getPlots()) {
UUID value=uCMap.get(plot.owner);
if (value != null) {
plot.owner=value;
}
plot.getTrusted().clear();
plot.getMembers().clear();
plot.getDenied().clear();
}
MainUtil.sendMessage(player,"String_Node_Str");
final AbstractDB database=DBFunc.dbManager;
boolean result=database.deleteTables();
MainUtil.sendMessage(player,"String_Node_Str");
try {
database.createTables();
if (!result) {
MainUtil.sendMessage(player,"String_Node_Str");
for (Plot plot : PS.get().getPlots()) {
UUID value=uCReverse.get(plot.owner);
if (value != null) {
plot.owner=value;
}
}
database.createPlotsAndData(new ArrayList<>(PS.get().getPlots()),new Runnable(){
@Override public void run(){
MainUtil.sendMessage(player,"String_Node_Str");
}
}
);
return;
}
}
 catch (Exception e) {
e.printStackTrace();
return;
}
if (newWrapper instanceof OfflineUUIDWrapper) {
PS.get().config.set("String_Node_Str",false);
PS.get().config.set("String_Node_Str",true);
}
 else if (newWrapper instanceof DefaultUUIDWrapper) {
PS.get().config.set("String_Node_Str",false);
PS.get().config.set("String_Node_Str",false);
}
try {
PS.get().config.save(PS.get().configFile);
}
 catch (IOException ignored) {
MainUtil.sendMessage(player,"String_Node_Str");
}
MainUtil.sendMessage(player,"String_Node_Str");
TaskManager.runTaskAsync(new Runnable(){
@Override public void run(){
ArrayList<Plot> plots=new ArrayList<>(PS.get().getPlots());
database.createPlotsAndData(plots,new Runnable(){
@Override public void run(){
MainUtil.sendMessage(player,"String_Node_Str");
}
}
);
}
}
);
MainUtil.sendMessage(player,"String_Node_Str");
MainUtil.sendMessage(player,"String_Node_Str");
}
}
);
return true;
}