if (filter == null || filter.accept(ref))
if (filter == null || filter.accept(ref.getMessage()))
   public List delivering(Filter filter)   {      List delivering = super.delivering(filter);            try      {         List persisted = pm.deliveries(channelID);         for(Iterator i = persisted.iterator(); i.hasNext(); )         {            StorageIdentifier id = (StorageIdentifier)i.next();            if (!id.storeID.equals(ms.getStoreID()))            {               // TODO maybe the channel could have access to multiple stores               throw new IllegalStateException("My current message store (id=" + ms.getStoreID() +                                               ") cannot reference messages being maintained by " +                                               "the store with id=" + id.storeID);            }            MessageReference ref = ms.getReference(id.messageID);            // TODO filtering could be probably pushed to the database            if (filter == null || filter.accept(ref))            {               delivering.add(ref);            }         }      }      catch(Throwable t)      {         log.error("Cannot get the delivery list from persistence manager", t);         return null;      }            return delivering;   }