commits@javamail.java.net

[javamail~mercurial:626] _at_Override doesn't work with interfaces in JDK 1.5, sigh.

From: <shannon_at_java.net>
Date: Thu, 9 Jan 2014 01:04:30 +0000

Project: javamail
Repository: mercurial
Revision: 626
Author: shannon
Date: 2014-01-03 22:58:42 UTC
Link:

Log Message:
------------
Move all the ntlm properties together.
add OAuth2 support for IMAP and SMTP - bug 6238
@Override doesn't work with interfaces in JDK 1.5, sigh.
use real serialVersionUID.


Revisions:
----------
624
625
626


Modified Paths:
---------------
mail/src/main/java/com/sun/mail/imap/package.html
doc/release/CHANGES.txt
mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java
mail/src/main/java/com/sun/mail/imap/protocol/IMAPSaslAuthenticator.java
mail/src/main/java/com/sun/mail/smtp/SMTPSaslAuthenticator.java
mail/src/main/java/com/sun/mail/smtp/package.html
mail/src/main/java/com/sun/mail/auth/OAuth2SaslClient.java
mail/src/main/java/com/sun/mail/auth/OAuth2SaslClientFactory.java


Added Paths:
------------
mail/src/main/java/com/sun/mail/auth/OAuth2SaslClient.java
mail/src/main/java/com/sun/mail/auth/OAuth2SaslClientFactory.java


Diffs:
------
diff -r 9da4f8cb1d80 -r 15a28dce559f mail/src/main/java/com/sun/mail/imap/package.html
--- a/mail/src/main/java/com/sun/mail/imap/package.html Fri Dec 06 16:02:14 2013 -0800
+++ b/mail/src/main/java/com/sun/mail/imap/package.html Fri Dec 06 16:42:13 2013 -0800
@@ -355,6 +355,24 @@
 </TR>
 
 <TR>
+<TD>mail.imap.auth.ntlm.domain</TD>
+<TD>String</TD>
+<TD>
+The NTLM authentication domain.
+</TD>
+</TR>
+
+<TR>
+<TD>mail.imap.auth.ntlm.flags</TD>
+<TD>int</TD>
+<TD>
+NTLM protocol-specific flags.
+See <A HREF="http://curl.haxx.se/rfc/ntlm.html#theNtlmFlags" TARGET="_top">
+http://curl.haxx.se/rfc/ntlm.html#theNtlmFlags</A> for details.
+</TD>
+</TR>
+
+<TR>
 <TD>mail.imap.proxyauth.user</TD>
 <TD>String</TD>
 <TD>If the server supports the PROXYAUTH extension, this property
@@ -442,24 +460,6 @@
 </TR>
 
 <TR>
-<TD>mail.imap.auth.ntlm.domain</TD>
-<TD>String</TD>
-<TD>
-The NTLM authentication domain.
-</TD>
-</TR>
-
-<TR>
-<TD>mail.imap.auth.ntlm.flags</TD>
-<TD>int</TD>
-<TD>
-NTLM protocol-specific flags.
-See <A HREF="http://curl.haxx.se/rfc/ntlm.html#theNtlmFlags" TARGET="_top">
-http://curl.haxx.se/rfc/ntlm.html#theNtlmFlags</A> for details.
-</TD>
-</TR>
-
-<TR>
 <TD>mail.imap.socketFactory</TD>
 <TD>SocketFactory</TD>
 <TD>


diff -r 15a28dce559f -r 89c66bacf700 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Fri Dec 06 16:42:13 2013 -0800
+++ b/doc/release/CHANGES.txt Fri Jan 03 13:23:35 2014 -0800
@@ -24,6 +24,7 @@
 K 6203 IMAP astring parsing incorrect
 K 6207 SMTP SASL support doesn't handle authentication failure properly
 K 6208 SASL authentication failures should not try other methods
+K 6238 add OAuth2 support to JavaMail
 
 
                   CHANGES IN THE 1.5.1 RELEASE

diff -r 15a28dce559f -r 89c66bacf700 mail/src/main/java/com/sun/mail/auth/OAuth2SaslClient.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/src/main/java/com/sun/mail/auth/OAuth2SaslClient.java Fri Jan 03 13:23:35 2014 -0800
@@ -0,0 +1,144 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package com.sun.mail.auth;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Map;
+import java.security.Provider;
+import java.security.Security;
+import javax.security.sasl.*;
+import javax.security.auth.callback.*;
+
+import com.sun.mail.util.ASCIIUtility;
+
+/**
+ * JavaMail SASL client for OAUTH2.
+ *
+ * @see <a href="http://tools.ietf.org/html/rfc6749">
+ * RFC 6749 - OAuth 2.0 Authorization Framework</a>
+ * @see <a href="http://tools.ietf.org/html/rfc6750">
+ * RFC 6750 - OAuth 2.0 Authorization Framework: Bearer Token Usage</a>
+ * @author Bill Shannon
+ */
+public class OAuth2SaslClient implements SaslClient {
+ private CallbackHandler cbh;
+ private Map<String,?> props; // XXX - not currently used
+ private boolean complete = false;
+
+ public OAuth2SaslClient(Map<String,?> props, CallbackHandler cbh) {
+ this.props = props;
+ this.cbh = cbh;
+ }
+
+ @Override
+ public String getMechanismName() {
+ return "XOAUTH2";
+ }
+
+ @Override
+ public boolean hasInitialResponse() {
+ return true;
+ }
+
+ @Override
+ public byte[] evaluateChallenge(byte[] challenge) throws SaslException {
+ if (complete)
+ return new byte[0];
+
+ NameCallback ncb = new NameCallback("User name:");
+ PasswordCallback pcb = new PasswordCallback("OAuth token:", false);
+ try {
+ cbh.handle(new Callback[] { ncb, pcb });
+ } catch (UnsupportedCallbackException ex) {
+ throw new SaslException("Unsupported callback", ex);
+ } catch (IOException ex) {
+ throw new SaslException("Callback handler failed", ex);
+ }
+
+ /*
+ * The OAuth token isn't really a password, and JavaMail doesn't
+ * use char[] for passwords, so we don't worry about storing the
+ * token in strings.
+ */
+ String user = ncb.getName();
+ String token = new String(pcb.getPassword());
+ pcb.clearPassword();
+ String resp = "user=" + user + "\001auth=Bearer " + token + "\001\001";
+ byte[] response;
+ try {
+ response = resp.getBytes("utf-8");
+ } catch (UnsupportedEncodingException ex) {
+ // fall back to ASCII
+ response = ASCIIUtility.getBytes(resp);
+ }
+ complete = true;
+ return response;
+ }
+
+ @Override
+ public boolean isComplete() {
+ return complete;
+ }
+
+ @Override
+ public byte[] unwrap(byte[] incoming, int offset, int len)
+ throws SaslException {
+ throw new IllegalStateException("OAUTH2 unwrap not supported");
+ }
+
+ @Override
+ public byte[] wrap(byte[] outgoing, int offset, int len)
+ throws SaslException {
+ throw new IllegalStateException("OAUTH2 wrap not supported");
+ }
+
+ @Override
+ public Object getNegotiatedProperty(String propName) {
+ if (!complete)
+ throw new IllegalStateException("OAUTH2 getNegotiatedProperty");
+ return null;
+ }
+
+ @Override
+ public void dispose() throws SaslException {
+ }
+}

diff -r 15a28dce559f -r 89c66bacf700 mail/src/main/java/com/sun/mail/auth/OAuth2SaslClientFactory.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/src/main/java/com/sun/mail/auth/OAuth2SaslClientFactory.java Fri Jan 03 13:23:35 2014 -0800
@@ -0,0 +1,97 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package com.sun.mail.auth;
+
+import java.util.*;
+import java.security.Provider;
+import java.security.Security;
+import javax.security.sasl.*;
+import javax.security.auth.callback.*;
+
+/**
+ * JavaMail SASL client factory for OAUTH2.
+ *
+ * @author Bill Shannon
+ */
+public class OAuth2SaslClientFactory implements SaslClientFactory {
+
+ private static final String PROVIDER_NAME = "JavaMail-OAuth2";
+ private static final String MECHANISM_NAME = "SaslClientFactory.XOAUTH2";
+
+ static class OAuth2Provider extends Provider {
+ //private static final long serialVersionUID = 0;
+
+ public OAuth2Provider() {
+ super(PROVIDER_NAME, 1.0, "XOAUTH2 SASL Mechanism");
+ put(MECHANISM_NAME, OAuth2SaslClientFactory.class.getName());
+ }
+ }
+
+ @Override
+ public SaslClient createSaslClient(String[] mechanisms,
+ String authorizationId, String protocol,
+ String serverName, Map<String,?> props,
+ CallbackHandler cbh) throws SaslException {
+ for (String m : mechanisms) {
+ if (m.equals("XOAUTH2"))
+ return new OAuth2SaslClient(props, cbh);
+ }
+ return null;
+ }
+
+ @Override
+ public String[] getMechanismNames(Map<String,?> props) {
+ return new String[] { "XOAUTH2" };
+ }
+
+ /**
+ * Initialize this OAUTH2 provider, but only if there isn't one already.
+ * If we're not allowed to add this provider, just give up silently.
+ */
+ public static void init() {
+ try {
+ if (Security.getProvider(PROVIDER_NAME) == null)
+ Security.addProvider(new OAuth2Provider());
+ } catch (SecurityException ex) {
+ // oh well...
+ }
+ }
+}

diff -r 15a28dce559f -r 89c66bacf700 mail/src/main/java/com/sun/mail/imap/package.html
--- a/mail/src/main/java/com/sun/mail/imap/package.html Fri Dec 06 16:42:13 2013 -0800
+++ b/mail/src/main/java/com/sun/mail/imap/package.html Fri Jan 03 13:23:35 2014 -0800
@@ -5,7 +5,7 @@
 
     DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
- Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved.
 
     The contents of this file are subject to the terms of either the GNU
     General Public License Version 2 only ("GPL") or the Common Development
@@ -62,9 +62,12 @@
 <H4>SASL Support</H4>
 <P>
 The IMAP protocol provider can use SASL
-(<A HREF="http://www.ietf.org/rfc/rfc2222.txt" TARGET="_top">RFC 2222</A>)
+(<A HREF="http://www.ietf.org/rfc/rfc4422.txt" TARGET="_top">RFC 4422</A>)
 authentication mechanisms on systems that support the
 <CODE>javax.security.sasl</CODE> APIs.
+The SASL-IR
+(<A HREF="http://www.ietf.org/rfc/rfc4959.txt" TARGET="_top">RFC 4959</A>)
+capability is also supported.
 In addition to the SASL mechanisms that are built into
 the SASL implementation, users can also provide additional
 SASL mechanisms of their own design to support custom authentication
@@ -73,6 +76,13 @@
 Java SASL API Programming and Deployment Guide</A> for details.
 Note that the current implementation doesn't support SASL mechanisms
 that provide their own integrity or confidentiality layer.
+<H4>OAuth 2.0 Support</H4>
+The SASL support described above is used to provide support for the
+<A HREF="https://developers.google.com/gmail/xoauth2_protocol" TARGET="_top">
+XOAUTH2 mechanism</A>.
+The OAuth 2.0 Access Token should be passed as the password for this mechanism.
+See <A HREF="https://java.net/projects/javamail/pages/OAuth2" TARGET="_top">
+OAuth2 Support</A> for details.
 <H4>Connection Pool</H4>
 <P>
 A connected IMAPStore maintains a pool of IMAP protocol objects for
@@ -95,7 +105,7 @@
 <H4>QUOTA Support</H4>
 <P>
 The IMAP QUOTA extension
-(<A HREF="http://www.ietf.org/rfc/rfc2087.txt">RFC 2087</A>)
+(<A HREF="http://www.ietf.org/rfc/rfc2087.txt" TARGET="_top">RFC 2087</A>)
 is supported via the
 {_at_link javax.mail.QuotaAwareStore QuotaAwareStore} interface implemented by
 {_at_link com.sun.mail.imap.IMAPStore IMAPStore}, and the
@@ -104,7 +114,7 @@
 <H4>ACL Support</H4>
 <P>
 The IMAP ACL extension
-(<A HREF="http://www.ietf.org/rfc/rfc2086.txt">RFC 2086</A>)
+(<A HREF="http://www.ietf.org/rfc/rfc2086.txt" TARGET="_top">RFC 2086</A>)
 is supported via the
 {_at_link com.sun.mail.imap.Rights Rights} class and the IMAPFolder methods
 {_at_link com.sun.mail.imap.IMAPFolder#getACL getACL},
@@ -117,7 +127,7 @@
 <H4>SORT Support</H4>
 <P>
 The IMAP SORT extension
-(<A HREF="http://www.ietf.org/rfc/rfc5256.txt">RFC 5256</A>)
+(<A HREF="http://www.ietf.org/rfc/rfc5256.txt" TARGET="_top">RFC 5256</A>)
 is supported via the
 {_at_link com.sun.mail.imap.SortTerm SortTerm} class and the IMAPFolder
 {_at_link com.sun.mail.imap.IMAPFolder#getSortedMessages getSortedMessages}

diff -r 15a28dce559f -r 89c66bacf700 mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java Fri Dec 06 16:42:13 2013 -0800
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java Fri Jan 03 13:23:35 2014 -0800
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved.
  *
  * The contents of this file are subject to the terms of either the GNU
  * General Public License Version 2 only ("GPL") or the Common Development
@@ -2675,7 +2675,7 @@
      *
      * @since JavaMail 1.4.1
      */
- public void idleAbort() throws ProtocolException {
+ public void idleAbort() {
         OutputStream os = getOutputStream();
         try {
             os.write(DONE);

diff -r 15a28dce559f -r 89c66bacf700 mail/src/main/java/com/sun/mail/imap/protocol/IMAPSaslAuthenticator.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/IMAPSaslAuthenticator.java Fri Dec 06 16:42:13 2013 -0800
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/IMAPSaslAuthenticator.java Fri Jan 03 13:23:35 2014 -0800
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved.
  *
  * The contents of this file are subject to the terms of either the GNU
  * General Public License Version 2 only ("GPL") or the Common Development
@@ -64,6 +64,18 @@
     private MailLogger logger;
     private String host;
 
+ /*
+ * This is a hack to initialize the OAUTH SASL provider just before,
+ * and only if, we might need it. This avoids the need for the user
+ * to initialize it explicitly, or manually configure the security
+ * providers file.
+ */
+ static {
+ try {
+ com.sun.mail.auth.OAuth2SaslClientFactory.init();
+ } catch (Throwable t) { }
+ }
+
     public IMAPSaslAuthenticator(IMAPProtocol pr, String name, Properties props,
                                 MailLogger logger, String host) {
         this.pr = pr;
@@ -142,8 +154,19 @@
             logger.fine("SASL client " + sc.getMechanismName());
 
         try {
- tag = pr.writeCommand("AUTHENTICATE " + sc.getMechanismName(),
- null);
+ Argument args = new Argument();
+ args.writeAtom(sc.getMechanismName());
+ if (pr.hasCapability("SASL-IR") && sc.hasInitialResponse()) {
+ String irs;
+ byte[] ba = sc.evaluateChallenge(new byte[0]);
+ if (ba.length > 0) {
+ ba = BASE64EncoderStream.encode(ba);
+ irs = ASCIIUtility.toString(ba, 0, ba.length);
+ } else
+ irs = "=";
+ args.writeAtom(irs);
+ }
+ tag = pr.writeCommand("AUTHENTICATE", args);
         } catch (Exception ex) {
             logger.log(Level.FINE, "SASL AUTHENTICATE Exception", ex);
             return false;

diff -r 15a28dce559f -r 89c66bacf700 mail/src/main/java/com/sun/mail/smtp/SMTPSaslAuthenticator.java
--- a/mail/src/main/java/com/sun/mail/smtp/SMTPSaslAuthenticator.java Fri Dec 06 16:42:13 2013 -0800
+++ b/mail/src/main/java/com/sun/mail/smtp/SMTPSaslAuthenticator.java Fri Jan 03 13:23:35 2014 -0800
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved.
  *
  * The contents of this file are subject to the terms of either the GNU
  * General Public License Version 2 only ("GPL") or the Common Development
@@ -63,6 +63,18 @@
     private MailLogger logger;
     private String host;
 
+ /*
+ * This is a hack to initialize the OAUTH SASL provider just before,
+ * and only if, we might need it. This avoids the need for the user
+ * to initialize it explicitly, or manually configure the security
+ * providers file.
+ */
+ static {
+ try {
+ com.sun.mail.auth.OAuth2SaslClientFactory.init();
+ } catch (Throwable t) { }
+ }
+
     public SMTPSaslAuthenticator(SMTPTransport pr, String name,
                 Properties props, MailLogger logger, String host) {
         this.pr = pr;
@@ -142,8 +154,11 @@
             String ir = null;
             if (sc.hasInitialResponse()) {
                 byte[] ba = sc.evaluateChallenge(new byte[0]);
- ba = BASE64EncoderStream.encode(ba);
- ir = ASCIIUtility.toString(ba, 0, ba.length);
+ if (ba.length > 0) {
+ ba = BASE64EncoderStream.encode(ba);
+ ir = ASCIIUtility.toString(ba, 0, ba.length);
+ } else
+ ir = "=";
             }
             if (ir != null)
                 resp = pr.simpleCommand("AUTH " + mech + " " + ir);

diff -r 15a28dce559f -r 89c66bacf700 mail/src/main/java/com/sun/mail/smtp/package.html
--- a/mail/src/main/java/com/sun/mail/smtp/package.html Fri Dec 06 16:42:13 2013 -0800
+++ b/mail/src/main/java/com/sun/mail/smtp/package.html Fri Jan 03 13:23:35 2014 -0800
@@ -5,7 +5,7 @@
 
     DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
- Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved.
 
     The contents of this file are subject to the terms of either the GNU
     General Public License Version 2 only ("GPL") or the Common Development
@@ -133,6 +133,13 @@
 Note that the current implementation doesn't support SASL mechanisms
 that provide their own integrity or confidentiality layer.
 <P>
+The SASL support described above is used to provide support for the
+<A HREF="https://developers.google.com/gmail/xoauth2_protocol" TARGET="_top">
+XOAUTH2 mechanism</A>.
+The OAuth 2.0 Access Token should be passed as the password for this mechanism.
+See <A HREF="https://java.net/projects/javamail/pages/OAuth2" TARGET="_top">
+OAuth2 Support</A> for details.
+<P>
 SMTP can also optionally request Delivery Status Notifications
 (<A HREF="http://www.ietf.org/rfc/rfc1891.txt" TARGET="_top">RFC 1891</A>).
 The delivery status will typically be reported using


diff -r 89c66bacf700 -r 7f8091908b18 mail/src/main/java/com/sun/mail/auth/OAuth2SaslClient.java
--- a/mail/src/main/java/com/sun/mail/auth/OAuth2SaslClient.java Fri Jan 03 13:23:35 2014 -0800
+++ b/mail/src/main/java/com/sun/mail/auth/OAuth2SaslClient.java Fri Jan 03 14:58:42 2014 -0800
@@ -69,17 +69,17 @@
         this.cbh = cbh;
     }
 
- @Override
+ //_at_Override
     public String getMechanismName() {
         return "XOAUTH2";
     }
 
- @Override
+ //_at_Override
     public boolean hasInitialResponse() {
         return true;
     }
 
- @Override
+ //_at_Override
     public byte[] evaluateChallenge(byte[] challenge) throws SaslException {
         if (complete)
             return new byte[0];
@@ -114,31 +114,31 @@
         return response;
     }
 
- @Override
+ //_at_Override
     public boolean isComplete() {
         return complete;
     }
 
- @Override
+ //_at_Override
     public byte[] unwrap(byte[] incoming, int offset, int len)
                                 throws SaslException {
         throw new IllegalStateException("OAUTH2 unwrap not supported");
     }
 
- @Override
+ //_at_Override
     public byte[] wrap(byte[] outgoing, int offset, int len)
                                 throws SaslException {
         throw new IllegalStateException("OAUTH2 wrap not supported");
     }
 
- @Override
+ //_at_Override
     public Object getNegotiatedProperty(String propName) {
         if (!complete)
             throw new IllegalStateException("OAUTH2 getNegotiatedProperty");
         return null;
     }
 
- @Override
+ //_at_Override
     public void dispose() throws SaslException {
     }
 }

diff -r 89c66bacf700 -r 7f8091908b18 mail/src/main/java/com/sun/mail/auth/OAuth2SaslClientFactory.java
--- a/mail/src/main/java/com/sun/mail/auth/OAuth2SaslClientFactory.java Fri Jan 03 13:23:35 2014 -0800
+++ b/mail/src/main/java/com/sun/mail/auth/OAuth2SaslClientFactory.java Fri Jan 03 14:58:42 2014 -0800
@@ -57,7 +57,7 @@
     private static final String MECHANISM_NAME = "SaslClientFactory.XOAUTH2";
 
     static class OAuth2Provider extends Provider {
- //private static final long serialVersionUID = 0;
+ private static final long serialVersionUID = -5371795551562287059L;
 
         public OAuth2Provider() {
             super(PROVIDER_NAME, 1.0, "XOAUTH2 SASL Mechanism");
@@ -65,7 +65,7 @@
         }
     }
 
- @Override
+ //_at_Override
     public SaslClient createSaslClient(String[] mechanisms,
                                 String authorizationId, String protocol,
                                 String serverName, Map<String,?> props,
@@ -77,7 +77,7 @@
         return null;
     }
 
- @Override
+ //_at_Override
     public String[] getMechanismNames(Map<String,?> props) {
         return new String[] { "XOAUTH2" };
     }