if (log.isTraceEnabled()) { log.trace(sql); }
   public List deliveries(Serializable channelID) throws Exception   {      if (log.isTraceEnabled()) { log.trace("listing deliveries for channel: " + channelID); }      Connection conn = null;      PreparedStatement ps = null;      ResultSet rs = null;            TransactionWrapper wrap = new TransactionWrapper();      try      {         conn = ds.getConnection();                        List result = new ArrayList();               String sql = "SELECT MESSAGEID, STOREID FROM DELIVERY WHERE CHANNELID=? AND STATE='C'";            ps = conn.prepareStatement(sql);         ps.setString(1, (String)channelID);                  rs = ps.executeQuery();         if (log.isTraceEnabled()) { log.trace(sql); }            int count = 0;         while (rs.next())         {            String id = rs.getString(1);            String storeID = rs.getString(2);            result.add(new StorageIdentifier(id, storeID));            count++;         }                  if (log.isTraceEnabled()) { log.trace("There are " + count + " deliveries"); }            return result;      }      catch (SQLException e)      {         wrap.exceptionOccurred();         throw e;      }      finally      {         if (rs != null)         {            try            {               rs.close();            }            catch (Throwable e)            {}         }         if (ps != null)         {            try            {               ps.close();            }            catch (Throwable e)            {}         }         if (conn != null)         {            try            {               conn.close();            }            catch (Throwable e)            {}         }         wrap.end();      }   }