if (stmt != null) stmt.close(); if (conn != null) conn.close();
conn.close();
  public String getBidHistory(Integer itemId) throws RemoteException   {    StringBuffer html = null;    PreparedStatement stmt = null;    ResultSet rs           = null;    Connection conn        = null;    String date = null, bidderName = null, itemName = null;    float bid = 0;    int userId = -1;    // get the item    try    {      conn = dataSource.getConnection();      stmt = conn.prepareStatement("SELECT name FROM items WHERE id=?");      stmt.setInt(1, itemId.intValue());      rs = stmt.executeQuery();    }    catch (Exception e)    {      try      {        if (stmt != null) stmt.close();        if (conn != null) conn.close();      }      catch (Exception ignore)      {      }      throw new RemoteException("Failed to execute Query for item in items table: " +e);    }    try     {      if (!rs.first())      {        stmt = conn.prepareStatement("SELECT name FROM old_items WHERE id=?");        stmt.setInt(1, itemId.intValue());        rs = stmt.executeQuery();      }    }    catch (Exception e)    {      try      {        if (stmt != null) stmt.close();        if (conn != null) conn.close();      }      catch (Exception ignore)      {      }      throw new RemoteException("Failed to execute Query for item in old_items table: " +e);    }    try     {      if (rs.first())      {        itemName = rs.getString("name");        html = new StringBuffer("<center><h3>Bid History for "+itemName+"<br></h3></center>");      }    }    catch (Exception e)    {      try      {        if (stmt != null) stmt.close();        if (conn != null) conn.close();      }      catch (Exception ignore)      {      }     throw new RemoteException("This item does not exist (got exception: " +e+")<br>");    }    // Get the list of the user's last bids    try     {      stmt = conn.prepareStatement("SELECT * FROM bids WHERE item_id=? ORDER BY date DESC");      stmt.setInt(1, itemId.intValue());      rs = stmt.executeQuery();      if (!rs.first())      {        if (stmt != null) stmt.close();        if (conn != null) conn.close();        return html.append("<h3>There is no bid corresponding to this item.</h3><br>").toString();      }    }    catch (SQLException e)    {      try      {        if (stmt != null) stmt.close();        if (conn != null) conn.close();      }      catch (Exception ignore)      {      }      throw new RemoteException("Exception getting bids list: " +e+"<br>");    }    try    {	        html.append(printBidHistoryHeader());      do       {        // Get the bids        date = rs.getString("date");        bid = rs.getFloat("bid");        userId = rs.getInt("user_id");        ResultSet urs = null;        try         {          stmt = conn.prepareStatement("SELECT nickname FROM users WHERE id=?");          stmt.setInt(1, userId);          urs = stmt.executeQuery();          if (urs.first())          {            bidderName = urs.getString("nickname");          }        }        catch (SQLException e)        {          try          {            if (stmt != null) stmt.close();            if (conn != null) conn.close();          }          catch (Exception ignore)          {          }          throw new RemoteException("Couldn't get bidder name: " +e+"<br>");        }        html.append(printBidHistory(userId, bidderName, bid, date));      }      while(rs.next());      html.append(printBidHistoryFooter());      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("Exception getting bid: " +e+"<br>");    }    return html.toString();  }