[jboss-jira] [JBoss JIRA] Created: (JBAS-6192) mail-ra call getNewMessages on pop3 folder, which always return false

peter andersen (JIRA) jira-events at lists.jboss.org
Wed Nov 12 03:14:36 EST 2008


mail-ra call getNewMessages on pop3 folder, which always return false
---------------------------------------------------------------------

                 Key: JBAS-6192
                 URL: https://jira.jboss.org/jira/browse/JBAS-6192
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: JCA service
    Affects Versions: JBossAS-4.2.3.GA
         Environment: Mac os, java 1.5
            Reporter: peter andersen
            Assignee: Jesper Pedersen


The 

org.jboss.resource.adapter.mail.inflow.MailFolder calls javax.mail.Folder.hasNewMessages() to check for new messages.

POP3Folder instances allways return false on this request, see:
http://java.sun.com/products/javamail/javadocs/com/sun/mail/pop3/POP3Folder.html

A quick fix/work around:

   public Message[] getNewMessages()
      throws Exception
   {
      Message msgs[] = {};
      /* This does not seem to be the most reliable new msg check. This should
      probably be unread msgs with the msgs marked as read on successful
      delivery.
      */
      if( folder.hasNewMessages() )
      {
         int newCount = folder.getNewMessageCount();
         int msgCount = folder.getMessageCount();
         msgs = folder.getMessages(msgCount - newCount + 1, msgCount);
         return msgs;
      }
	  // Special handling of POP3, hasNewMessages() always returns false. 	
	  if (protocol.equalsIgnoreCase("pop3")) {
         msgs = folder.getMessages();	
         return msgs;
	  }	

      return msgs;
   }



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list