try { pstmt.close(); } catch (Exception ignore) {}
  public String listItem(Integer userId, Connection conn) throws RemoteException  {    StringBuffer sell = new StringBuffer();    ResultSet currentSellings = null;    ResultSet pastSellings = null;    PreparedStatement stmt = null;    String itemName, endDate, startDate;    float currentPrice=0, initialPrice=0, buyNow=0, reservePrice=0;    int quantity=0, itemId=-1;    // Retrieve ItemHome to get the names of the items the user sold    try     {      stmt = conn.prepareStatement("SELECT * FROM items WHERE items.seller=? AND items.end_date>=NOW()");      stmt.setInt(1, userId.intValue());      currentSellings = stmt.executeQuery();    }    catch (Exception e)    {      try { stmt.close(); } catch (Exception ignore) {}      try { conn.close(); } catch (Exception ignore) {}      throw new RemoteException("Exception getting current sellings list: " +e+"<br>");    }    try     {      stmt = conn.prepareStatement("SELECT * FROM old_items WHERE old_items.seller=? AND TO_DAYS(NOW()) - TO_DAYS(old_items.end_date) < 30");      stmt.setInt(1, userId.intValue());      pastSellings = stmt.executeQuery();    }    catch (Exception e)    {      try { stmt.close(); } catch (Exception ignore) {}      try { conn.close(); } catch (Exception ignore) {}      throw new RemoteException("Exception getting past sellings list: " +e+"<br>");    }    try    {      if (currentSellings.first())      {        // display current sellings        sell.append(printSellHeader("Items you are currently selling."));        do        {          // Get the name of the items          try          {            itemId = currentSellings.getInt("id");            itemName = currentSellings.getString("name");            endDate = currentSellings.getString("end_date");            startDate = currentSellings.getString("start_date");            initialPrice = currentSellings.getFloat("initial_price");            reservePrice = currentSellings.getFloat("reserve_price");            buyNow = currentSellings.getFloat("buy_now");            quantity = currentSellings.getInt("quantity");            currentPrice = currentSellings.getFloat("max_bid");            if (currentPrice <initialPrice)              currentPrice = initialPrice;          }          catch (Exception e)           {            try { stmt.close(); } catch (Exception ignore) {}            try { conn.close(); } catch (Exception ignore) {}            throw new RemoteException("Exception getting item: " + e +"<br>");          }          // display information about the item          sell.append(printSell(itemId, itemName,  initialPrice, currentPrice,  quantity, reservePrice, buyNow, startDate, endDate));        }        while (currentSellings.next());        sell.append(printItemFooter());      }      else      {        sell.append("<br>");        sell.append(printHTMLHighlighted("<h3>You are currently selling no item.</h3>"));      }    }    catch (Exception e)     {      try { stmt.close(); } catch (Exception ignore) {}      try { conn.close(); } catch (Exception ignore) {}      throw new RemoteException("Exception getting current items in sell: " + e +"<br>");    }    try    {      if (pastSellings.first())      {        // display past sellings        sell.append("<br>");        sell.append(printSellHeader("Items you sold in the last 30 days."));        do         {          // Get the name of the items          try          {            itemId = pastSellings.getInt("id");            itemName = pastSellings.getString("name");            endDate = pastSellings.getString("end_date");            startDate = pastSellings.getString("start_date");            initialPrice = pastSellings.getFloat("initial_price");            reservePrice = pastSellings.getFloat("reserve_price");            buyNow = pastSellings.getFloat("buy_now");            quantity = pastSellings.getInt("quantity");            currentPrice = pastSellings.getFloat("max_bid");            if (currentPrice <initialPrice)              currentPrice = initialPrice;          }          catch (Exception e)           {            try { stmt.close(); } catch (Exception ignore) {}            try { conn.close(); } catch (Exception ignore) {}            throw new RemoteException("Exception getting sold item: " + e +"<br>");          }          // display information about the item          sell.append(printSell(itemId, itemName,  initialPrice, currentPrice,  quantity, reservePrice, buyNow, startDate, endDate));        }        while (pastSellings.next());        sell.append(printItemFooter());      }      else      {        sell.append(printHTMLHighlighted("<br><h3>You didn't sell any item in the past 30 days.</h3>"));        if (stmt != null) stmt.close();        return sell.toString();      }      stmt.close();    }    catch (Exception e)     {      try { stmt.close(); } catch (Exception ignore) {}      try { conn.close(); } catch (Exception ignore) {}      throw new RemoteException("Exception getting sold items: " + e +"<br>");    }    return sell.toString();  }