stmt.close();
  public String listBoughtItems(Integer userId, Connection conn) throws RemoteException   {    ResultSet buy = null;    PreparedStatement stmt = null;    String itemName = null, sellerName = null;    int quantity=0, sellerId=-1, itemId=-1;    float buyNow=0;    StringBuffer html = new StringBuffer();    // Get the list of items the user bought    try     {      stmt = conn.prepareStatement("SELECT * FROM buy_now WHERE buy_now.buyer_id=? AND TO_DAYS(NOW()) - TO_DAYS(buy_now.date)<=30");      stmt.setInt(1, userId.intValue());      buy = stmt.executeQuery();      stmt.close();      if (!buy.first())      {        return printHTMLHighlighted("<br><h3>You didn't buy any item in the last 30 days.</h3><br>");      }    }    catch (Exception e)    {      try { stmt.close(); } catch (Exception ignore) {}      try { conn.close(); } catch (Exception ignore) {}      throw new RemoteException("Exception getting bought items list: " +e+"<br>");    }    html.append(printUserBoughtItemHeader());    PreparedStatement itemStmt = null;    PreparedStatement sellerStmt = null;    try    {      itemStmt = conn.prepareStatement("SELECT * FROM items WHERE id=?");      sellerStmt = conn.prepareStatement("SELECT nickname FROM users WHERE id=?");      ResultSet itemRS = null;      ResultSet sellerResult = null;      do      {	itemId = buy.getInt("item_id");	quantity = buy.getInt("qty");        // Get the name of the items                itemStmt.setInt(1, itemId);        itemRS = itemStmt.executeQuery();        if (itemRS.first())        {          itemName = itemRS.getString("name");          sellerId = itemRS.getInt("seller");          buyNow = itemRS.getFloat("buy_now");        }        sellerStmt.setInt(1, sellerId);        sellerResult = sellerStmt.executeQuery();        // Get the seller's name		         if (sellerResult.first())           sellerName = sellerResult.getString("nickname");        // display information about the item        html.append(printUserBoughtItem(itemId, itemName, quantity, buyNow, sellerId, sellerName));      }      while (buy.next());      itemStmt.close();      sellerStmt.close();    }    catch (Exception e)    {      try { itemStmt.close(); } catch (Exception ignore) {}      try { sellerStmt.close(); } catch (Exception ignore) {}      throw new RemoteException("Exception getting bought items: " +e+"<br>");    }    html.append(printItemFooter());    return html.toString();  }