issues@javamail.java.net

[Bug 5830] New: IMAPProtocol.sasllogin uses old constructor for IMAPSaslAuthenticator

From: <bugzilla-daemon_at_kenai.com>
Date: Tue, 26 Feb 2013 21:59:46 +0000

http://kenai.com/bugzilla/show_bug.cgi?id=5830

             Bug #: 5830
           Summary: IMAPProtocol.sasllogin uses old constructor for
                    IMAPSaslAuthenticator
    Classification: Unclassified
           Product: javamail
           Version: 1.4.6
          Platform: Macintosh
        OS/Version: Mac OS
            Status: NEW
          Severity: blocker
          Priority: P5
         Component: imap
        AssignedTo: shannon_at_kenai.com
        ReportedBy: dres_at_kenai.com
                CC: issues_at_javamail.kenai.com


The constructor of IMAPSaslAuthenticator was changed (in a patch release
nontheless!) to accept a MailLogger instead of PrintStream. the
IMAPProtocol.sasllogin method uses old constructor signature with the
reflection api leading to the exception below:

java.lang.NoSuchMethodException:
com.sun.mail.imap.protocol.IMAPSaslAuthenticator.<init>(com.sun.mail.imap.protocol.IMAPProtocol,
java.lang.String, java.util.Properties, boolean, java.io.PrintStream,
java.lang.String)
    at java.lang.Class.getConstructor0(Class.java:2715)
    at java.lang.Class.getConstructor(Class.java:1659)
    at com.sun.mail.imap.protocol.IMAPProtocol.sasllogin(IMAPProtocol.java:718)
    at com.sun.mail.imap.IMAPStore.login(IMAPStore.java:731)
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:642)
    at javax.mail.Service.connect(Service.java:295)

I suggest re-adding the old constructor for backwards compatibility and
changing the sasllogin method to use the new constructor.

The offending code:

Class sac = Class.forName(
            "com.sun.mail.imap.protocol.IMAPSaslAuthenticator");
        Constructor c = sac.getConstructor(new Class[] {
                    IMAPProtocol.class,
                    String.class,
                    Properties.class,
                    Boolean.TYPE,
                    PrintStream.class, //should be MailLogger
                    String.class
                    });
        saslAuthenticator = (SaslAuthenticator)c.newInstance(
                    new Object[] {
                    this,
                    name,
                    props,
                    logger,
                    host
                    });

-- 
Configure bugmail: http://kenai.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.