Program: 42064
Project: 42064
Buggy source:
/** 
 * Get plots where the player is allowed or owns.
 * @param playername
 * @param playerId
 * @param world
 * @param ownedonly Only get the plots the player owns
 * @return
 */
private List<Plot> getPlayerPlots(String playername,UUID playerId,String world,boolean ownedonly){
  List<Plot> ret=new ArrayList<>();
  PreparedStatement statementPlot=null;
  PreparedStatement statementAllowed=null;
  PreparedStatement statementDenied=null;
  ResultSet setPlots=null;
  try {
    Connection conn=getConnection();
    String query="String_Node_Str";
    if (ownedonly) {
      query+="String_Node_Str";
    }
 else {
      query+="String_Node_Str";
    }
    query+="String_Node_Str";
    if (playerId == null) {
      if (ownedonly) {
        query+="String_Node_Str";
      }
 else {
        query+="String_Node_Str";
      }
    }
 else {
      if (ownedonly) {
        query+="String_Node_Str";
      }
 else {
        query+="String_Node_Str";
      }
    }
    if (!world.isEmpty()) {
      query+="String_Node_Str";
    }
    statementPlot=conn.prepareStatement(query);
    if (playerId == null) {
      statementPlot.setString(1,playername);
      if (!ownedonly) {
        statementPlot.setString(2,playername);
        if (!world.isEmpty()) {
          statementPlot.setString(3,world);
        }
      }
 else       if (!world.isEmpty()) {
        statementPlot.setString(2,world);
      }
    }
 else {
      statementPlot.setBytes(1,UUIDFetcher.toBytes(playerId));
      if (!ownedonly) {
        statementPlot.setBytes(2,UUIDFetcher.toBytes(playerId));
        if (!world.isEmpty()) {
          statementPlot.setString(3,world);
        }
      }
 else       if (!world.isEmpty()) {
        statementPlot.setString(2,world);
      }
    }
    setPlots=statementPlot.executeQuery();
    while (setPlots.next()) {
      int idX=setPlots.getInt("String_Node_Str");
      int idZ=setPlots.getInt("String_Node_Str");
      String biome=setPlots.getString("String_Node_Str");
      Date expireddate=null;
      try {
        expireddate=setPlots.getDate("String_Node_Str");
      }
 catch (      SQLException ignored) {
      }
      boolean finished=setPlots.getBoolean("String_Node_Str");
      PlayerList allowed=new PlayerList();
      PlayerList denied=new PlayerList();
      double customprice=setPlots.getDouble("String_Node_Str");
      boolean forsale=setPlots.getBoolean("String_Node_Str");
      String finisheddate=setPlots.getString("String_Node_Str");
      boolean protect=setPlots.getBoolean("String_Node_Str");
      String currentbidder=setPlots.getString("String_Node_Str");
      double currentbid=setPlots.getDouble("String_Node_Str");
      boolean auctionned=setPlots.getBoolean("String_Node_Str");
      String currworld=setPlots.getString("String_Node_Str");
      String owner=setPlots.getString("String_Node_Str");
      byte[] byBidder=setPlots.getBytes("String_Node_Str");
      byte[] byOwner=setPlots.getBytes("String_Node_Str");
      UUID currentbidderid=null;
      if (byBidder != null) {
        currentbidderid=UUIDFetcher.fromBytes(byBidder);
      }
      UUID ownerId=null;
      if (byOwner != null) {
        ownerId=UUIDFetcher.fromBytes(byOwner);
      }
      statementAllowed=conn.prepareStatement("String_Node_Str");
      statementAllowed.setString(1,currworld);
      statementAllowed.setInt(2,idX);
      statementAllowed.setInt(3,idZ);
      ResultSet setAllowed=statementAllowed.executeQuery();
      while (setAllowed.next()) {
        byte[] byPlayerId=setAllowed.getBytes("String_Node_Str");
        if (byPlayerId == null) {
          allowed.put(setAllowed.getString("String_Node_Str"));
        }
 else {
          allowed.put(setAllowed.getString("String_Node_Str"),UUIDFetcher.fromBytes(byPlayerId));
        }
      }
      setAllowed.close();
      statementDenied=conn.prepareStatement("String_Node_Str");
      statementDenied.setString(1,currworld);
      statementDenied.setInt(2,idX);
      statementDenied.setInt(3,idZ);
      ResultSet setDenied=statementDenied.executeQuery();
      while (setDenied.next()) {
        byte[] byPlayerId=setDenied.getBytes("String_Node_Str");
        if (byPlayerId == null) {
          denied.put(setDenied.getString("String_Node_Str"));
        }
 else {
          denied.put(setDenied.getString("String_Node_Str"),UUIDFetcher.fromBytes(byPlayerId));
        }
      }
      setDenied.close();
      Plot plot=new Plot(plugin,owner,ownerId,currworld,biome,expireddate,finished,allowed,idX + "String_Node_Str" + idZ,customprice,forsale,finisheddate,protect,currentbidder,currentbidderid,currentbid,auctionned,denied);
      ret.add(plot);
    }
  }
 catch (  SQLException ex) {
    plugin.getLogger().severe("String_Node_Str");
    plugin.getLogger().severe(ex.getMessage());
  }
 finally {
    try {
      if (statementPlot != null) {
        statementPlot.close();
      }
      if (statementAllowed != null) {
        statementAllowed.close();
      }
      if (statementDenied != null) {
        statementDenied.close();
      }
      if (setPlots != null) {
        setPlots.close();
      }
    }
 catch (    SQLException ex) {
      plugin.getLogger().severe("String_Node_Str");
      plugin.getLogger().severe(ex.getMessage());
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Get plots where the player is allowed or owns.
 * @param playername
 * @param playerId
 * @param world
 * @param ownedonly Only get the plots the player owns
 * @return
 */
private List<Plot> getPlayerPlots(String playername,UUID playerId,String world,boolean ownedonly){
  List<Plot> ret=new ArrayList<>();
  PreparedStatement statementPlot=null;
  PreparedStatement statementAllowed=null;
  PreparedStatement statementDenied=null;
  ResultSet setPlots=null;
  try {
    Connection conn=getConnection();
    String query="String_Node_Str";
    if (ownedonly) {
      query+="String_Node_Str";
    }
 else {
      query+="String_Node_Str";
    }
    query+="String_Node_Str";
    if (playerId == null) {
      if (ownedonly) {
        query+="String_Node_Str";
      }
 else {
        query+="String_Node_Str";
      }
    }
 else {
      if (ownedonly) {
        query+="String_Node_Str";
      }
 else {
        query+="String_Node_Str";
      }
    }
    if (!world.isEmpty()) {
      query+="String_Node_Str";
    }
    statementPlot=conn.prepareStatement(query);
    if (playerId == null) {
      statementPlot.setString(1,playername);
      if (!ownedonly) {
        statementPlot.setString(2,playername);
        if (!world.isEmpty()) {
          statementPlot.setString(3,world.toLowerCase());
        }
      }
 else       if (!world.isEmpty()) {
        statementPlot.setString(2,world.toLowerCase());
      }
    }
 else {
      statementPlot.setBytes(1,UUIDFetcher.toBytes(playerId));
      if (!ownedonly) {
        statementPlot.setBytes(2,UUIDFetcher.toBytes(playerId));
        if (!world.isEmpty()) {
          statementPlot.setString(3,world.toLowerCase());
        }
      }
 else       if (!world.isEmpty()) {
        statementPlot.setString(2,world.toLowerCase());
      }
    }
    setPlots=statementPlot.executeQuery();
    while (setPlots.next()) {
      int idX=setPlots.getInt("String_Node_Str");
      int idZ=setPlots.getInt("String_Node_Str");
      String biome=setPlots.getString("String_Node_Str");
      Date expireddate=null;
      try {
        expireddate=setPlots.getDate("String_Node_Str");
      }
 catch (      SQLException ignored) {
      }
      boolean finished=setPlots.getBoolean("String_Node_Str");
      PlayerList allowed=new PlayerList();
      PlayerList denied=new PlayerList();
      double customprice=setPlots.getDouble("String_Node_Str");
      boolean forsale=setPlots.getBoolean("String_Node_Str");
      String finisheddate=setPlots.getString("String_Node_Str");
      boolean protect=setPlots.getBoolean("String_Node_Str");
      String currentbidder=setPlots.getString("String_Node_Str");
      double currentbid=setPlots.getDouble("String_Node_Str");
      boolean auctionned=setPlots.getBoolean("String_Node_Str");
      String currworld=setPlots.getString("String_Node_Str");
      String owner=setPlots.getString("String_Node_Str");
      byte[] byBidder=setPlots.getBytes("String_Node_Str");
      byte[] byOwner=setPlots.getBytes("String_Node_Str");
      UUID currentbidderid=null;
      if (byBidder != null) {
        currentbidderid=UUIDFetcher.fromBytes(byBidder);
      }
      UUID ownerId=null;
      if (byOwner != null) {
        ownerId=UUIDFetcher.fromBytes(byOwner);
      }
      statementAllowed=conn.prepareStatement("String_Node_Str");
      statementAllowed.setString(1,currworld.toLowerCase());
      statementAllowed.setInt(2,idX);
      statementAllowed.setInt(3,idZ);
      ResultSet setAllowed=statementAllowed.executeQuery();
      while (setAllowed.next()) {
        byte[] byPlayerId=setAllowed.getBytes("String_Node_Str");
        if (byPlayerId == null) {
          allowed.put(setAllowed.getString("String_Node_Str"));
        }
 else {
          allowed.put(setAllowed.getString("String_Node_Str"),UUIDFetcher.fromBytes(byPlayerId));
        }
      }
      setAllowed.close();
      statementDenied=conn.prepareStatement("String_Node_Str");
      statementDenied.setString(1,currworld.toLowerCase());
      statementDenied.setInt(2,idX);
      statementDenied.setInt(3,idZ);
      ResultSet setDenied=statementDenied.executeQuery();
      while (setDenied.next()) {
        byte[] byPlayerId=setDenied.getBytes("String_Node_Str");
        if (byPlayerId == null) {
          denied.put(setDenied.getString("String_Node_Str"));
        }
 else {
          denied.put(setDenied.getString("String_Node_Str"),UUIDFetcher.fromBytes(byPlayerId));
        }
      }
      setDenied.close();
      Plot plot=new Plot(plugin,owner,ownerId,currworld,biome,expireddate,finished,allowed,idX + "String_Node_Str" + idZ,customprice,forsale,finisheddate,protect,currentbidder,currentbidderid,currentbid,auctionned,denied);
      ret.add(plot);
    }
  }
 catch (  SQLException ex) {
    plugin.getLogger().severe("String_Node_Str");
    plugin.getLogger().severe(ex.getMessage());
  }
 finally {
    try {
      if (statementPlot != null) {
        statementPlot.close();
      }
      if (statementAllowed != null) {
        statementAllowed.close();
      }
      if (statementDenied != null) {
        statementDenied.close();
      }
      if (setPlots != null) {
        setPlots.close();
      }
    }
 catch (    SQLException ex) {
      plugin.getLogger().severe("String_Node_Str");
      plugin.getLogger().severe(ex.getMessage());
    }
  }
  return ret;
}