Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-1375

IMap server fails to search for mail using SearchTerms which contain USER flags

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.0-beta3
    • Fix Version/s: None
    • Component/s: IMAPServer
    • Labels:
      None

      Description

      The code below will fail

      public void testWithSearchTerm() throws Exception {
      	Properties props = System.getProperties();
      	props.setProperty("mail.store.protocol", "imap");
      	props.setProperty("mail.debug", "true");
      
      	Session session = Session.getDefaultInstance(props);
      	URLName urlName = new URLName(
      				"imap://oleg%40oleg-2.local:password@oleg-2.local/INBOX");
      	Store store = session.getStore(urlName);
      	if (!store.isConnected()) {
      		store.connect();
      		Folder folder = store.getFolder(urlName);
      		folder.open(2);
      		NotTerm notJunk = new NotTerm(new FlagTerm(new Flags("foo"), true));
      		folder.search(notJunk);
      	}
      }
      

      with

      Caused by: com.sun.mail.iap.BadCommandException: A4 BAD SEARCH failed. Illegal arguments.
      	at com.sun.mail.iap.Protocol.handleResult(Protocol.java:346)
      	at com.sun.mail.imap.protocol.IMAPProtocol.issueSearch(IMAPProtocol.java:1693)
      	at com.sun.mail.imap.protocol.IMAPProtocol.search(IMAPProtocol.java:1599)
      	at com.sun.mail.imap.protocol.IMAPProtocol.search(IMAPProtocol.java:1586)
      	at com.sun.mail.imap.IMAPFolder.search(IMAPFolder.java:1649)
      

      However setting the user flag works fine and it can be seen in the incoming message

        Attachments

        1. james-1375.txt
          2 kB
          Oleg Zhurakousky

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ozhurakousky Oleg Zhurakousky
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: