if (stmt != null) stmt.close(); if (conn != null) conn.close();
stmt.close(); conn.close();
  public String getItems(Integer categoryId, Integer regionId, int page, int nbOfItems) throws RemoteException  {    Connection        conn = null;    PreparedStatement stmt = null;    ResultSet rs           = null;     String itemName, endDate;    int itemId;    float maxBid, initialPrice;    int nbOfBids=0;    StringBuffer html = new StringBuffer();    // get the list of items    try    {      conn = dataSource.getConnection();      stmt = conn.prepareStatement("SELECT items.name, items.id, items.end_date, items.max_bid, items.nb_of_bids, items.initial_price FROM items,users WHERE items.category=? AND items.seller=users.id AND users.region=? AND end_date>=NOW() LIMIT ?,?");      stmt.setInt(1, categoryId.intValue());      stmt.setInt(2, regionId.intValue());      stmt.setInt(3, page*nbOfItems);      stmt.setInt(4, nbOfItems);      rs = stmt.executeQuery();      if (stmt != null) stmt.close();      if (conn != null) conn.close();    }    catch (SQLException e)    {      try      {        if (stmt != null) stmt.close();        if (conn != null) conn.close();      }      catch (Exception ignore)      {      }      throw new RemoteException("Failed to get the items: " +e);    }    try     {      while (rs.next())       {        itemName = rs.getString("name");        itemId = rs.getInt("id");        endDate = rs.getString("end_date");        maxBid = rs.getFloat("max_bid");        nbOfBids = rs.getInt("nb_of_bids");        initialPrice = rs.getFloat("initial_price");        if (maxBid <initialPrice)          maxBid = initialPrice;        html.append(printItem(itemName, itemId, maxBid, nbOfBids, endDate));      }    }     catch (Exception e)    {        throw new RemoteException("Cannot get items list: " +e);    }    return html.toString();  }