Program: 57874
Project: 57874
Buggy source:
@Override public void execute(final PlotPlayer player,String[] args,RunnableVal3<Command,Runnable,Runnable> confirm,final RunnableVal2<Command,CommandResult> whenDone) throws CommandException {
  if (args.length == 1 && args[0].contains("String_Node_Str")) {
    args=args[0].split("String_Node_Str");
  }
  int page=Integer.MIN_VALUE;
  Collection<Plot> unsorted=null;
  PlotArea sortByArea=player.getApplicablePlotArea();
  boolean shouldSortByArea=Settings.Teleport.PER_WORLD_VISIT;
switch (args.length) {
case 2:
    if (MathMan.isInteger(args[1])) {
      page=tryReadPageIdFromArg(player,args[1]);
    }
 else {
      C.COMMAND_SYNTAX.send(player,getUsage());
      return;
    }
case 1:
  boolean isCorrectSyntaxWithoutResults=false;
Collection<Plot> plots=new HashSet<Plot>();
if (args[0] != null) {
plots=getPlotsFromSingleArgument(args[0],sortByArea);
if (!plots.isEmpty()) {
  unsorted=plots;
}
 else {
  if (MathMan.isInteger(args[0])) {
    page=tryReadPageIdFromArg(player,args[0]);
    if (page != PAGE_OUT_OF_RANGE && page != Integer.MIN_VALUE) {
      unsorted=PS.get().getPlots(player);
    }
  }
 else {
    isCorrectSyntaxWithoutResults=true;
  }
}
}
if (!isCorrectSyntaxWithoutResults && plots.isEmpty() && page == Integer.MIN_VALUE) {
C.COMMAND_SYNTAX.send(player,getUsage());
return;
}
break;
case 0:
unsorted=PS.get().getPlots(player);
break;
default :
C.COMMAND_SYNTAX.send(player,getUsage());
return;
}
if (page == Integer.MIN_VALUE) {
page=1;
}
if (unsorted == null || unsorted.isEmpty()) {
C.FOUND_NO_PLOTS.send(player);
return;
}
Iterator<Plot> iterator=unsorted.iterator();
while (iterator.hasNext()) {
if (!iterator.next().isBasePlot()) {
iterator.remove();
}
}
if (page < 1 || page > unsorted.size()) {
C.NOT_VALID_NUMBER.send(player,"String_Node_Str" + unsorted.size() + "String_Node_Str");
return;
}
List<Plot> plots;
if (shouldSortByArea) {
plots=PS.get().sortPlots(unsorted,PS.SortType.CREATION_DATE,sortByArea);
}
 else {
plots=PS.get().sortPlotsByTemp(unsorted);
}
final Plot plot=plots.get(page - 1);
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player,C.PERMISSION_VISIT_UNOWNED)) {
C.NO_PERMISSION.send(player,C.PERMISSION_VISIT_UNOWNED);
return;
}
}
 else if (plot.isOwner(player.getUUID())) {
if (!Permissions.hasPermission(player,C.PERMISSION_VISIT_OWNED) && !Permissions.hasPermission(player,C.PERMISSION_HOME)) {
C.NO_PERMISSION.send(player,C.PERMISSION_VISIT_OWNED);
return;
}
}
 else if (plot.isAdded(player.getUUID())) {
if (!Permissions.hasPermission(player,C.PERMISSION_SHARED)) {
C.NO_PERMISSION.send(player,C.PERMISSION_SHARED);
return;
}
}
 else {
if (!Permissions.hasPermission(player,C.PERMISSION_VISIT_OTHER)) {
C.NO_PERMISSION.send(player,C.PERMISSION_VISIT_OTHER);
return;
}
}
confirm.run(this,new Runnable(){
@Override public void run(){
if (plot.teleportPlayer(player)) {
whenDone.run(Visit.this,CommandResult.SUCCESS);
}
 else {
whenDone.run(Visit.this,CommandResult.FAILURE);
}
}
}
,new Runnable(){
@Override public void run(){
whenDone.run(Visit.this,CommandResult.FAILURE);
}
}
);
}

Fixed version (ground truth):
@Override public void execute(final PlotPlayer player,String[] args,RunnableVal3<Command,Runnable,Runnable> confirm,final RunnableVal2<Command,CommandResult> whenDone) throws CommandException {
  if (args.length == 1 && args[0].contains("String_Node_Str")) {
    args=args[0].split("String_Node_Str");
  }
  int page=Integer.MIN_VALUE;
  Collection<Plot> unsorted=null;
  PlotArea sortByArea=player.getApplicablePlotArea();
  boolean shouldSortByArea=Settings.Teleport.PER_WORLD_VISIT;
switch (args.length) {
case 2:
    if (MathMan.isInteger(args[1])) {
      page=tryReadPageIdFromArg(player,args[1]);
    }
 else {
      C.COMMAND_SYNTAX.send(player,getUsage());
      return;
    }
case 1:
  boolean isCorrectSyntaxWithoutResults=false;
Collection<Plot> plots=new HashSet<Plot>();
if (args[0] != null) {
plots=getPlotsFromSingleArgument(args[0],sortByArea);
if (!plots.isEmpty()) {
  unsorted=plots;
}
 else {
  if (MathMan.isInteger(args[0])) {
    page=tryReadPageIdFromArg(player,args[0]);
    if (page != PAGE_OUT_OF_RANGE && page != Integer.MIN_VALUE) {
      unsorted=PS.get().getPlots(player);
    }
  }
 else {
    isCorrectSyntaxWithoutResults=true;
  }
}
}
if (!isCorrectSyntaxWithoutResults && plots.isEmpty() && page == Integer.MIN_VALUE) {
C.COMMAND_SYNTAX.send(player,getUsage());
return;
}
if ((args[0].contains("String_Node_Str") || args[0].contains("String_Node_Str")) && (unsorted == null || unsorted.isEmpty())) {
Plot plot=MainUtil.getPlotFromString(player,args[0],true);
if (plot != null) {
unsorted=Collections.singletonList(plot.getBasePlot(false));
}
}
break;
case 0:
unsorted=PS.get().getPlots(player);
break;
default :
C.COMMAND_SYNTAX.send(player,getUsage());
return;
}
if (page == Integer.MIN_VALUE) {
page=1;
}
if (unsorted == null || unsorted.isEmpty()) {
C.FOUND_NO_PLOTS.send(player);
return;
}
Iterator<Plot> iterator=unsorted.iterator();
while (iterator.hasNext()) {
if (!iterator.next().isBasePlot()) {
iterator.remove();
}
}
if (page < 1 || page > unsorted.size()) {
C.NOT_VALID_NUMBER.send(player,"String_Node_Str" + unsorted.size() + "String_Node_Str");
return;
}
List<Plot> plots;
if (shouldSortByArea) {
plots=PS.get().sortPlots(unsorted,PS.SortType.CREATION_DATE,sortByArea);
}
 else {
plots=PS.get().sortPlotsByTemp(unsorted);
}
final Plot plot=plots.get(page - 1);
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player,C.PERMISSION_VISIT_UNOWNED)) {
C.NO_PERMISSION.send(player,C.PERMISSION_VISIT_UNOWNED);
return;
}
}
 else if (plot.isOwner(player.getUUID())) {
if (!Permissions.hasPermission(player,C.PERMISSION_VISIT_OWNED) && !Permissions.hasPermission(player,C.PERMISSION_HOME)) {
C.NO_PERMISSION.send(player,C.PERMISSION_VISIT_OWNED);
return;
}
}
 else if (plot.isAdded(player.getUUID())) {
if (!Permissions.hasPermission(player,C.PERMISSION_SHARED)) {
C.NO_PERMISSION.send(player,C.PERMISSION_SHARED);
return;
}
}
 else {
if (!Permissions.hasPermission(player,C.PERMISSION_VISIT_OTHER)) {
C.NO_PERMISSION.send(player,C.PERMISSION_VISIT_OTHER);
return;
}
}
confirm.run(this,new Runnable(){
@Override public void run(){
if (plot.teleportPlayer(player)) {
whenDone.run(Visit.this,CommandResult.SUCCESS);
}
 else {
whenDone.run(Visit.this,CommandResult.FAILURE);
}
}
}
,new Runnable(){
@Override public void run(){
whenDone.run(Visit.this,CommandResult.FAILURE);
}
}
);
}