Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-6192

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Major
    • No Release
    • JBossAS-4.2.3.GA
    • JCA service
    • None

    Description

      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;
      }

      Attachments

        Activity

          People

            jpederse@redhat.com Jesper Pedersen
            peterandersen_jira peter andersen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: