commits@javamail.java.net

[javamail~mercurial:872] detect error and throw ParsingException instead of NPE - bug 8487

From: <shannon_at_java.net>
Date: Tue, 4 Oct 2016 21:11:10 +0000

Project: javamail
Repository: mercurial
Revision: 872
Author: shannon
Date: 2016-10-03 21:22:38 UTC
Link:

Log Message:
------------
Increase sleep time to ensure timeout occurs even on slow machines - bug 8404
Fix typos (thanks, Anthony!); remove incorrect compatibility note.
Store, Transport, and Folder should implement AutoCloseable - bug 6823
Malformed IMAP FETCH response throws the wrong exception - bug 8420
Handle illegal CAPABILITY response after LOGIN/AUTHENTICATE - bug 7371
support varargs in MailLogger.log
RFC822.SIZE > 2GB isn't handled - bug 8422
The UIDFolder interface should have a getter for UIDNEXT - bug 6281
Update to latest sigtest tools and JavaMail 1.6 signatures.
Protocol#command method call readResponse after IOException is thrown - bug 8486
detect error and throw ParsingException instead of NPE - bug 8487


Revisions:
----------
862
863
864
865
866
867
868
869
870
871
872


Modified Paths:
---------------
doc/release/CHANGES.txt
mail/src/test/java/com/sun/mail/util/WriteTimeoutSocketTest.java
doc/release/COMPAT.txt
doc/spec/JavaMail-1.6-changes.txt
mail/src/main/java/javax/mail/Folder.java
mail/src/main/java/javax/mail/Service.java
mail/src/main/java/com/sun/mail/imap/protocol/FetchResponse.java
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/util/MailLogger.java
mail/src/main/java/com/sun/mail/imap/IMAPMessage.java
mail/src/main/java/com/sun/mail/imap/protocol/RFC822SIZE.java
mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
mail/src/main/java/javax/mail/UIDFolder.java
mail.sig
siggen
sigtest
mail/src/main/java/com/sun/mail/iap/Protocol.java
mail/src/main/java/com/sun/mail/imap/protocol/Status.java
mail/src/test/java/com/sun/mail/imap/protocol/StatusTest.java


Added Paths:
------------
mail/src/test/java/com/sun/mail/imap/IMAPLoginCapabilitiesTest.java
mail/src/test/java/com/sun/mail/imap/IMAPMessageTest.java


Diffs:
------
diff -r 53775e8a580b -r 6b59de87fd43 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Wed Aug 31 16:57:52 2016 -0700
+++ b/doc/release/CHANGES.txt Wed Sep 07 10:57:08 2016 -0700
@@ -25,6 +25,7 @@
 K 8398 MailSessionDefinition should use the Repeatable annotation for Java EE 8
 K 8399 IdleManager fails on Android
 K 8403 Test fails: javax.mail.internet.GetLocalAddressTest
+K 8404 Tests fail: com.sun.mail.util.WriteTimeoutSocketTest
 K 8405 MboxFolder.expunge can corrupt mailbox file
 K 8415 Update public API to use generics
 

diff -r 53775e8a580b -r 6b59de87fd43 mail/src/test/java/com/sun/mail/util/WriteTimeoutSocketTest.java
--- a/mail/src/test/java/com/sun/mail/util/WriteTimeoutSocketTest.java Wed Aug 31 16:57:52 2016 -0700
+++ b/mail/src/test/java/com/sun/mail/util/WriteTimeoutSocketTest.java Wed Sep 07 10:57:08 2016 -0700
@@ -267,7 +267,8 @@
         @Override
         protected void collectMessage(int bytes) throws IOException {
             try {
- Thread.sleep(TIMEOUT*2);
+ // allow plenty of time for even slow machines to time out
+ Thread.sleep(TIMEOUT*20);
             } catch (InterruptedException ex) { }
             super.collectMessage(bytes);
         }


diff -r 6b59de87fd43 -r 8c3b506091af doc/release/COMPAT.txt
--- a/doc/release/COMPAT.txt Wed Sep 07 10:57:08 2016 -0700
+++ b/doc/release/COMPAT.txt Wed Sep 07 11:06:23 2016 -0700
@@ -43,9 +43,7 @@
 
         * parse(String) now throws a ParseException on invalid input instead
           of returning null, to conform to the DateFormat contract
- * with lenient parsing: reject years that have not been specified in the
- RFC, notably single-digit years, and years in the range [1000,1899]
- * the following methods now throw UnsupprotedOperationException
+ * the following methods now throw UnsupportedOperationException
           to prevent tampering with MailDateFormat's internals:
 
                 get2DigitYearStart

diff -r 6b59de87fd43 -r 8c3b506091af doc/spec/JavaMail-1.6-changes.txt
--- a/doc/spec/JavaMail-1.6-changes.txt Wed Sep 07 10:57:08 2016 -0700
+++ b/doc/spec/JavaMail-1.6-changes.txt Wed Sep 07 11:06:23 2016 -0700
@@ -30,7 +30,7 @@
             ...
         }
 
-The Repeatble annotation is not know to Java SE 7 and will be ignored
+The Repeatable annotation is not known to Java SE 7 and will be ignored
 when JavaMail 1.6 is used on Java SE 7 (as expected).
 
 


diff -r 8c3b506091af -r 742f2c04e6c1 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Wed Sep 07 11:06:23 2016 -0700
+++ b/doc/release/CHANGES.txt Wed Sep 07 16:16:43 2016 -0700
@@ -20,6 +20,7 @@
 The following bugs have been fixed in the 1.6.0 release.
 
 K 6074 MimeMessage.updateHeaders should set the Date header if not already set
+K 6823 Store, Transport, and Folder should implement AutoCloseable
 K 6949 MailDateFormat changes for version 1.6
 K 7010 Fix javac warnings
 K 8398 MailSessionDefinition should use the Repeatable annotation for Java EE 8

diff -r 8c3b506091af -r 742f2c04e6c1 doc/spec/JavaMail-1.6-changes.txt
--- a/doc/spec/JavaMail-1.6-changes.txt Wed Sep 07 11:06:23 2016 -0700
+++ b/doc/spec/JavaMail-1.6-changes.txt Wed Sep 07 16:16:43 2016 -0700
@@ -320,3 +320,48 @@
         public MailDateFormat clone() {
             return (MailDateFormat) super.clone();
         }
+
+
+===================================================================
+
+5. Store, Transport, and Folder should implement AutoCloseable (6823)
+---------------------------------------------------------------------
+
+To enable use in a try-with-resources block, the Store, Transport,
+and Folder classes should implement the java.lang.AutoCloseable interface.
+Store and Transport are subclasses of Service, which already has the
+required close() method, so having Service implement AutoCloseable is
+sufficient. The Folder class includes a close method with a required
+"expunge" parameter so we add a new close() method with no parameter
+that behaves the same as close(true), and have Folder implement AutoCloseable.
+
+ public abstract class Service implements AutoCloseable {
+ ...
+ }
+
+ public abstract class Folder implements AutoCloseable {
+ ...
+
+ /**
+ * Close this Folder and expunge deleted messages. <p>
+ *
+ * A CLOSED ConnectionEvent is delivered to any ConnectionListeners
+ * registered on this Folder. Note that the folder is closed even
+ * if this method terminates abnormally by throwing a
+ * MessagingException. <p>
+ *
+ * This method supports the {_at_link java.lang.AutoCloseable AutoCloseable}
+ * interface. <p>
+ *
+ * This implementation calls <code>close(true)</code>.
+ *
+ * @exception IllegalStateException if this folder is not opened
+ * @exception MessagingException for other failures
+ * @see javax.mail.event.ConnectionEvent
+ * @since JavaMail 1.6
+ */
+ @Override
+ public void close() throws MessagingException {
+ close(true);
+ }
+ }

diff -r 8c3b506091af -r 742f2c04e6c1 mail/src/main/java/javax/mail/Folder.java
--- a/mail/src/main/java/javax/mail/Folder.java Wed Sep 07 11:06:23 2016 -0700
+++ b/mail/src/main/java/javax/mail/Folder.java Wed Sep 07 16:16:43 2016 -0700
@@ -116,7 +116,7 @@
  * @author Bill Shannon
  */
 
-public abstract class Folder {
+public abstract class Folder implements AutoCloseable {
 
     /**
      * The parent store.
@@ -647,6 +647,29 @@
     public abstract void close(boolean expunge) throws MessagingException;
 
     /**
+ * Close this Folder and expunge deleted messages. <p>
+ *
+ * A CLOSED ConnectionEvent is delivered to any ConnectionListeners
+ * registered on this Folder. Note that the folder is closed even
+ * if this method terminates abnormally by throwing a
+ * MessagingException. <p>
+ *
+ * This method supports the {_at_link java.lang.AutoCloseable AutoCloseable}
+ * interface. <p>
+ *
+ * This implementation calls <code>close(true)</code>.
+ *
+ * @exception IllegalStateException if this folder is not opened
+ * @exception MessagingException for other failures
+ * @see javax.mail.event.ConnectionEvent
+ * @since JavaMail 1.6
+ */
+ @Override
+ public void close() throws MessagingException {
+ close(true);
+ }
+
+ /**
      * Indicates whether this Folder is in the 'open' state.
      * @return true if this Folder is in the 'open' state.
      */

diff -r 8c3b506091af -r 742f2c04e6c1 mail/src/main/java/javax/mail/Service.java
--- a/mail/src/main/java/javax/mail/Service.java Wed Sep 07 11:06:23 2016 -0700
+++ b/mail/src/main/java/javax/mail/Service.java Wed Sep 07 16:16:43 2016 -0700
@@ -59,7 +59,7 @@
  * @author Kanwar Oberoi
  */
 
-public abstract class Service {
+public abstract class Service implements AutoCloseable {
 
     /**
      * The session from which this service was created.


diff -r 742f2c04e6c1 -r a58544745584 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Wed Sep 07 16:16:43 2016 -0700
+++ b/doc/release/CHANGES.txt Wed Sep 07 16:52:28 2016 -0700
@@ -29,6 +29,7 @@
 K 8404 Tests fail: com.sun.mail.util.WriteTimeoutSocketTest
 K 8405 MboxFolder.expunge can corrupt mailbox file
 K 8415 Update public API to use generics
+K 8420 Malformed IMAP FETCH response throws the wrong exception
 
 
                   CHANGES IN THE 1.5.6 RELEASE

diff -r 742f2c04e6c1 -r a58544745584 mail/src/main/java/com/sun/mail/imap/protocol/FetchResponse.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/FetchResponse.java Wed Sep 07 16:16:43 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/FetchResponse.java Wed Sep 07 16:52:28 2016 -0700
@@ -228,7 +228,7 @@
      */
     private String next20() {
         if (index + 20 > size)
- return ASCIIUtility.toString(buffer, index, index + size);
+ return ASCIIUtility.toString(buffer, index, size);
         else
             return ASCIIUtility.toString(buffer, index, index + 20) + "...";
     }


diff -r a58544745584 -r 5747dabb8c22 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Wed Sep 07 16:52:28 2016 -0700
+++ b/doc/release/CHANGES.txt Fri Sep 09 17:13:09 2016 -0700
@@ -23,6 +23,7 @@
 K 6823 Store, Transport, and Folder should implement AutoCloseable
 K 6949 MailDateFormat changes for version 1.6
 K 7010 Fix javac warnings
+K 7371 IMAP doesn't handle illegal CAPABILITY response after LOGIN/AUTHENTICATE
 K 8398 MailSessionDefinition should use the Repeatable annotation for Java EE 8
 K 8399 IdleManager fails on Android
 K 8403 Test fails: javax.mail.internet.GetLocalAddressTest

diff -r a58544745584 -r 5747dabb8c22 mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java Wed Sep 07 16:52:28 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java Fri Sep 09 17:13:09 2016 -0700
@@ -213,24 +213,36 @@
         Response[] r = command("CAPABILITY", null);
         Response response = r[r.length-1];
 
- if (response.isOK()) {
- capabilities = new HashMap<>(10);
- authmechs = new ArrayList<>(5);
- for (int i = 0, len = r.length; i < len; i++) {
- if (!(r[i] instanceof IMAPResponse))
- continue;
-
- IMAPResponse ir = (IMAPResponse)r[i];
-
- // Handle *all* untagged CAPABILITY responses.
- // Though the spec seemingly states that only
- // one CAPABILITY response string is allowed (6.1.1),
- // some server vendors claim otherwise.
- if (ir.keyEquals("CAPABILITY"))
- parseCapabilities(ir);
+ if (response.isOK())
+ handleCapabilityResponse(r);
+ handleResult(response);
+ }
+
+ /**
+ * Handle any untagged CAPABILITY response in the Response array.
+ */
+ public void handleCapabilityResponse(Response[] r) {
+ boolean first = true;
+ for (int i = 0, len = r.length; i < len; i++) {
+ if (!(r[i] instanceof IMAPResponse))
+ continue;
+
+ IMAPResponse ir = (IMAPResponse)r[i];
+
+ // Handle *all* untagged CAPABILITY responses.
+ // Though the spec seemingly states that only
+ // one CAPABILITY response string is allowed (6.1.1),
+ // some server vendors claim otherwise.
+ if (ir.keyEquals("CAPABILITY")) {
+ if (first) {
+ // clear out current when first response seen
+ capabilities = new HashMap<>(10);
+ authmechs = new ArrayList<>(5);
+ first = false;
+ }
+ parseCapabilities(ir);
             }
         }
- handleResult(response);
     }
 
     /**
@@ -493,6 +505,9 @@
             resumeTracing();
         }
 
+ // handle an illegal but not uncommon untagged CAPABILTY response
+ handleCapabilityResponse(r);
+
         // dispatch untagged responses
         notifyResponseHandlers(r);
 
@@ -596,13 +611,18 @@
             resumeTracing();
         }
 
- /* Dispatch untagged responses.
+ Response[] responses = v.toArray(new Response[v.size()]);
+
+ // handle an illegal but not uncommon untagged CAPABILTY response
+ handleCapabilityResponse(responses);
+
+ /*
+ * Dispatch untagged responses.
          * NOTE: in our current upper level IMAP classes, we add the
          * responseHandler to the Protocol object only *after* the
          * connection has been authenticated. So, for now, the below
          * code really ends up being just a no-op.
          */
- Response[] responses = v.toArray(new Response[v.size()]);
         notifyResponseHandlers(responses);
 
         // Handle the final OK, NO, BAD or BYE response
@@ -706,13 +726,18 @@
             resumeTracing();
         }
 
- /* Dispatch untagged responses.
+ Response[] responses = v.toArray(new Response[v.size()]);
+
+ // handle an illegal but not uncommon untagged CAPABILTY response
+ handleCapabilityResponse(responses);
+
+ /*
+ * Dispatch untagged responses.
          * NOTE: in our current upper level IMAP classes, we add the
          * responseHandler to the Protocol object only *after* the
          * connection has been authenticated. So, for now, the below
          * code really ends up being just a no-op.
          */
- Response[] responses = v.toArray(new Response[v.size()]);
         notifyResponseHandlers(responses);
 
         // Handle the final OK, NO, BAD or BYE response
@@ -803,6 +828,11 @@
             resumeTracing();
         }
 
+ Response[] responses = v.toArray(new Response[v.size()]);
+
+ // handle an illegal but not uncommon untagged CAPABILTY response
+ handleCapabilityResponse(responses);
+
         /*
          * Dispatch untagged responses.
          * NOTE: in our current upper level IMAP classes, we add the
@@ -810,7 +840,6 @@
          * connection has been authenticated. So, for now, the below
          * code really ends up being just a no-op.
          */
- Response[] responses = v.toArray(new Response[v.size()]);
         notifyResponseHandlers(responses);
 
         // Handle the final OK, NO, BAD or BYE response
@@ -897,13 +926,18 @@
             resumeTracing();
         }
 
- /* Dispatch untagged responses.
+ Response[] responses = v.toArray(new Response[v.size()]);
+
+ // handle an illegal but not uncommon untagged CAPABILTY response
+ handleCapabilityResponse(responses);
+
+ /*
+ * Dispatch untagged responses.
          * NOTE: in our current upper level IMAP classes, we add the
          * responseHandler to the Protocol object only *after* the
          * connection has been authenticated. So, for now, the below
          * code really ends up being just a no-op.
          */
- Response[] responses = v.toArray(new Response[v.size()]);
         notifyResponseHandlers(responses);
 
         // Handle the final OK, NO, BAD or BYE response

diff -r a58544745584 -r 5747dabb8c22 mail/src/main/java/com/sun/mail/imap/protocol/IMAPSaslAuthenticator.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/IMAPSaslAuthenticator.java Wed Sep 07 16:52:28 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/IMAPSaslAuthenticator.java Fri Sep 09 17:13:09 2016 -0700
@@ -261,13 +261,18 @@
             }
         }
 
- /* Dispatch untagged responses.
+ Response[] responses = v.toArray(new Response[v.size()]);
+
+ // handle an illegal but not uncommon untagged CAPABILTY response
+ pr.handleCapabilityResponse(responses);
+
+ /*
+ * Dispatch untagged responses.
          * NOTE: in our current upper level IMAP classes, we add the
          * responseHandler to the Protocol object only *after* the
          * connection has been authenticated. So, for now, the below
          * code really ends up being just a no-op.
          */
- Response[] responses = v.toArray(new Response[v.size()]);
         pr.notifyResponseHandlers(responses);
 
         // Handle the final OK, NO, BAD or BYE response

diff -r a58544745584 -r 5747dabb8c22 mail/src/test/java/com/sun/mail/imap/IMAPLoginCapabilitiesTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/src/test/java/com/sun/mail/imap/IMAPLoginCapabilitiesTest.java Fri Sep 09 17:13:09 2016 -0700
@@ -0,0 +1,152 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2009-2016 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.imap;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.mail.Session;
+import javax.mail.Store;
+
+import com.sun.mail.test.TestServer;
+
+import org.junit.Test;
+import org.junit.Rule;
+import org.junit.rules.Timeout;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Test that capabilities are updated after login.
+ */
+public final class IMAPLoginCapabilitiesTest {
+
+ private static final String NEWCAP = "NEWCAP";
+
+ private static final int TIMEOUT = 1000; // 1 second
+
+ // timeout the test in case of deadlock
+ @Rule
+ public Timeout deadlockTimeout = Timeout.millis(5 * TIMEOUT);
+
+ /**
+ * Test untagged CAPABILITY response after LOGIN.
+ * This is illegal, but mail.ru and AOL do it.
+ */
+ @Test
+ public void testUntaggedCapabilityAfterLogin() {
+ test(new IMAPHandler() {
+ @Override
+ public void login() throws IOException {
+ untagged("CAPABILITY " + capabilities +
+ " " + NEWCAP);
+ ok("LOGIN completed");
+ }
+ });
+ }
+
+ /**
+ * Test multiple untagged CAPABILITY responses after LOGIN.
+ * This should NEVER happen, but we handle it just in case.
+ */
+ @Test
+ public void testMultipleUntaggedCapabilityAfterLogin() {
+ test(new IMAPHandler() {
+ @Override
+ public void login() throws IOException {
+ untagged("CAPABILITY " + capabilities);
+ untagged("CAPABILITY " + NEWCAP);
+ ok("LOGIN completed");
+ }
+ });
+ }
+
+ /**
+ * Test untagged CAPABILITY response after AUTHENTICATE.
+ */
+ @Test
+ public void testUntaggedCapabilityAfterAuthenticate() {
+ test(new IMAPHandler() {
+ {{ capabilities += " AUTH=PLAIN"; }}
+ @Override
+ public void authplain(String ir) throws IOException {
+ untagged("CAPABILITY " + capabilities +
+ " " + NEWCAP);
+ ok("AUTHENTICATE completed");
+ }
+ });
+ }
+
+ private void test(IMAPHandler handler) {
+ TestServer server = null;
+ try {
+ server = new TestServer(handler);
+ server.start();
+
+ final Properties properties = new Properties();
+ properties.setProperty("mail.imap.host", "localhost");
+ properties.setProperty("mail.imap.port", "" + server.getPort());
+ //properties.setProperty("mail.debug.auth", "true");
+ final Session session = Session.getInstance(properties);
+ //session.setDebug(true);
+
+ final IMAPStore store = (IMAPStore)session.getStore("imap");
+ try {
+ store.connect("test", "test");
+ assertTrue(store.hasCapability(NEWCAP));
+ } catch (Exception ex) {
+ System.out.println(ex);
+ //ex.printStackTrace();
+ fail(ex.toString());
+ } finally {
+ store.close();
+ }
+ } catch (final Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if (server != null) {
+ server.quit();
+ }
+ }
+ }
+}


diff -r 5747dabb8c22 -r a074271daff7 mail/src/main/java/com/sun/mail/util/MailLogger.java
--- a/mail/src/main/java/com/sun/mail/util/MailLogger.java Fri Sep 09 17:13:09 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/util/MailLogger.java Mon Sep 12 11:56:41 2016 -0700
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 2012-2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012-2016 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
@@ -263,7 +263,7 @@
      * @param msg the message.
      * @param params the message parameters.
      */
- public void log(Level level, String msg, Object params[]) {
+ public void log(Level level, String msg, Object... params) {
         if (debug) {
             msg = MessageFormat.format(msg, params);
             debugOut(msg);


diff -r a074271daff7 -r d9e1bb6b86cd doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Mon Sep 12 11:56:41 2016 -0700
+++ b/doc/release/CHANGES.txt Mon Sep 12 17:10:56 2016 -0700
@@ -31,6 +31,7 @@
 K 8405 MboxFolder.expunge can corrupt mailbox file
 K 8415 Update public API to use generics
 K 8420 Malformed IMAP FETCH response throws the wrong exception
+K 8422 RFC822.SIZE > 2GB isn't handled
 
 
                   CHANGES IN THE 1.5.6 RELEASE

diff -r a074271daff7 -r d9e1bb6b86cd mail/src/main/java/com/sun/mail/imap/IMAPMessage.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPMessage.java Mon Sep 12 11:56:41 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPMessage.java Mon Sep 12 17:10:56 2016 -0700
@@ -91,7 +91,7 @@
     protected Map<String, Object> items; // Map<String,Object>
 
     private Date receivedDate; // INTERNALDATE
- private int size = -1; // RFC822.SIZE
+ private long size = -1; // RFC822.SIZE
 
     private Boolean peek; // use BODY.PEEK when fetching content?
 
@@ -500,6 +500,8 @@
      *
      * Note that this returns RFC822.SIZE. That is, it's the
      * size of the whole message, header and body included.
+ * Note also that if the size of the message is greater than
+ * Integer.MAX_VALUE (2GB), this method returns Integer.MAX_VALUE.
      */
     @Override
     public int getSize() throws MessagingException {
@@ -507,6 +509,23 @@
         // if bodyLoaded, size is already set
         if (size == -1)
             loadEnvelope(); // XXX - could just fetch the size
+ if (size > Integer.MAX_VALUE)
+ return Integer.MAX_VALUE; // the best we can do...
+ else
+ return (int)size;
+ }
+
+ /**
+ * Get the message size as a long. <p>
+ *
+ * Suitable for messages that might be larger than 2GB.
+ * @since JavaMail 1.6
+ */
+ public long getSizeLong() throws MessagingException {
+ checkExpunged();
+ // if bodyLoaded, size is already set
+ if (size == -1)
+ loadEnvelope(); // XXX - could just fetch the size
         return size;
     }
 

diff -r a074271daff7 -r d9e1bb6b86cd mail/src/main/java/com/sun/mail/imap/protocol/RFC822SIZE.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/RFC822SIZE.java Mon Sep 12 11:56:41 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/RFC822SIZE.java Mon Sep 12 17:10:56 2016 -0700
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
@@ -53,7 +53,7 @@
     static final char[] name = {'R','F','C','8','2','2','.','S','I','Z','E'};
     public int msgno;
 
- public int size;
+ public long size;
 
     /**
      * Constructor.
@@ -64,6 +64,6 @@
     public RFC822SIZE(FetchResponse r) throws ParsingException {
         msgno = r.getNumber();
         r.skipSpaces();
- size = r.readNumber();
+ size = r.readLong();
     }
 }

diff -r a074271daff7 -r d9e1bb6b86cd mail/src/test/java/com/sun/mail/imap/IMAPMessageTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/src/test/java/com/sun/mail/imap/IMAPMessageTest.java Mon Sep 12 17:10:56 2016 -0700
@@ -0,0 +1,191 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2009-2016 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.imap;
+
+import java.io.IOException;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.Set;
+import java.util.HashSet;
+
+import javax.mail.Folder;
+import javax.mail.Session;
+import javax.mail.Store;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+
+import com.sun.mail.test.TestServer;
+
+import org.junit.Test;
+import org.junit.Rule;
+import org.junit.rules.Timeout;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+/**
+ * Test IMAPMessage methods.
+ */
+public final class IMAPMessageTest {
+
+ // timeout the test in case of deadlock
+ @Rule
+ public Timeout deadlockTimeout = Timeout.seconds(20);
+
+ private static final String RDATE = "23-Jun-2004 06:26:26 -0700";
+ private static final String ENVELOPE =
+ "(\"Wed, 23 Jun 2004 18:56:42 +0530\" \"test\" " +
+ "((\"JavaMail\" NIL \"testuser\" \"example.com\")) " +
+ "((\"JavaMail\" NIL \"testuser\" \"example.com\")) " +
+ "((\"JavaMail\" NIL \"testuser\" \"example.com\")) " +
+ "((NIL NIL \"testuser\" \"example.com\")) NIL NIL NIL " +
+ "\"<40D98512.9040803_at_example.com>\")";
+
+ public static interface IMAPTest {
+ public void test(Folder folder, IMAPHandlerMessage handler)
+ throws MessagingException;
+ }
+
+ /**
+ * Test that a small message size is returned correctly.
+ */
+ @Test
+ public void testSizeSmall() {
+ testWithHandler(
+ new IMAPTest() {
+ @Override
+ public void test(Folder folder, IMAPHandlerMessage handler)
+ throws MessagingException {
+ Message m = folder.getMessage(1);
+ assertEquals(123, m.getSize());
+ }
+ },
+ new IMAPHandlerMessage() {
+ {{ size = 123; }}
+ });
+ }
+
+ /**
+ * Test that a large message size is returned as Integer.MAX_VALUE
+ * from MimeMessage.getSize and returned as the actual value from
+ * IMAPMessage.getSizeLong.
+ */
+ @Test
+ public void testSizeLarge() {
+ testWithHandler(
+ new IMAPTest() {
+ @Override
+ public void test(Folder folder, IMAPHandlerMessage handler)
+ throws MessagingException {
+ Message m = folder.getMessage(1);
+ assertEquals(Integer.MAX_VALUE, m.getSize());
+ assertEquals((long)Integer.MAX_VALUE + 1,
+ ((IMAPMessage)m).getSizeLong());
+ }
+ },
+ new IMAPHandlerMessage() {
+ {{ size = (long)Integer.MAX_VALUE + 1; }}
+ });
+ }
+
+ public void testWithHandler(IMAPTest test, IMAPHandlerMessage handler) {
+ TestServer server = null;
+ try {
+ server = new TestServer(handler);
+ server.start();
+
+ final Properties properties = new Properties();
+ properties.setProperty("mail.imap.host", "localhost");
+ properties.setProperty("mail.imap.port", "" + server.getPort());
+ final Session session = Session.getInstance(properties);
+ //session.setDebug(true);
+
+ final Store store = session.getStore("imap");
+ Folder folder = null;
+ try {
+ store.connect("test", "test");
+ folder = store.getFolder("INBOX");
+ folder.open(Folder.READ_ONLY);
+ test.test(folder, handler);
+ } catch (Exception ex) {
+ System.out.println(ex);
+ //ex.printStackTrace();
+ fail(ex.toString());
+ } finally {
+ if (folder != null)
+ folder.close(false);
+ store.close();
+ }
+ } catch (final Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if (server != null) {
+ server.quit();
+ }
+ }
+ }
+
+ /**
+ * Custom handler.
+ */
+ private static class IMAPHandlerMessage extends IMAPHandler {
+
+ String rdate = RDATE;
+ String envelope = ENVELOPE;
+ long size = 0;
+
+ @Override
+ public void examine() throws IOException {
+ numberOfMessages = 1;
+ super.examine();
+ }
+
+ @Override
+ public void fetch(String line) throws IOException {
+ untagged("1 FETCH (ENVELOPE " + envelope +
+ " INTERNALDATE \"" + rdate + "\" " +
+ "RFC822.SIZE " + size + ")");
+ ok();
+ }
+ }
+}


diff -r d9e1bb6b86cd -r 8d2c9063ccc1 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Mon Sep 12 17:10:56 2016 -0700
+++ b/doc/release/CHANGES.txt Thu Sep 22 17:23:47 2016 -0700
@@ -20,6 +20,7 @@
 The following bugs have been fixed in the 1.6.0 release.
 
 K 6074 MimeMessage.updateHeaders should set the Date header if not already set
+K 6281 The UIDFolder interface should have a getter for UIDNEXT
 K 6823 Store, Transport, and Folder should implement AutoCloseable
 K 6949 MailDateFormat changes for version 1.6
 K 7010 Fix javac warnings

diff -r d9e1bb6b86cd -r 8d2c9063ccc1 doc/release/COMPAT.txt
--- a/doc/release/COMPAT.txt Mon Sep 12 17:10:56 2016 -0700
+++ b/doc/release/COMPAT.txt Thu Sep 22 17:23:47 2016 -0700
@@ -52,6 +52,13 @@
                 set2DigitYearStart
                 setDateFormatSymbols
 
+- method added to UIDFolder interface
+
+ The UIDFolder interface has a new getUIDNext() method. Any
+ classes implementing the UIDFolder interface will need to add
+ this method. The IMAPFolder class implements the UIDFolder
+ interface and has provided this method for some time.
+
 
 
 -- JavaMail 1.5.6 --

diff -r d9e1bb6b86cd -r 8d2c9063ccc1 doc/spec/JavaMail-1.6-changes.txt
--- a/doc/spec/JavaMail-1.6-changes.txt Mon Sep 12 17:10:56 2016 -0700
+++ b/doc/spec/JavaMail-1.6-changes.txt Thu Sep 22 17:23:47 2016 -0700
@@ -365,3 +365,41 @@
                 close(true);
             }
         }
+
+
+===================================================================
+
+6. The UIDFolder interface should have a getter for UIDNEXT (6281)
+------------------------------------------------------------------
+
+The UIDFolder interface models the UID support in the IMAP protocol.
+After UIDFolder was originally created, the IMAP protocol added
+support for getting the value of the next UID that will be assigned.
+The IMAP provider in JavaMail has supported this for quite some time;
+it should be added to the UIDFolder interface:
+
+ /**
+ * Returns the predicted UID that will be assigned to the
+ * next message that is appended to this folder.
+ * Messages might be appended to the folder after this value
+ * is retrieved, causing this value to be out of date.
+ * This value might only be updated when a folder is first opened.
+ * Note that messages may have been appended to the folder
+ * while it was open and thus this value may be out of
+ * date. <p>
+ *
+ * If the value is unknown, -1 is returned. <p>
+ *
+ * @return the UIDNEXT value, or -1 if unknown
+ * @exception MessagingException for failures
+ * @since JavaMail 1.6
+ */
+ public long getUIDNext() throws MessagingException;
+
+Ideally this new method added to the interface would include a default
+implementation to provide compatibility with existing classes that
+implement this method. However, since the JavaMail 1.6 reference
+implementation targets Java SE 7, this is not possible. It's very
+likely that the only class implementing this interface is the IMAPFolder
+class in the JavaMail reference implementation, thus this incompatibility
+is extremely unlikely to cause a problem in practice.

diff -r d9e1bb6b86cd -r 8d2c9063ccc1 mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Mon Sep 12 17:10:56 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Thu Sep 22 17:23:47 2016 -0700
@@ -2559,7 +2559,7 @@
      * @exception MessagingException for failures
      * @since JavaMail 1.3.3
      */
- // Not a UIDFolder method, but still useful
+ @Override
     public synchronized long getUIDNext() throws MessagingException {
         if (opened) // we already have this information
             return uidnext;

diff -r d9e1bb6b86cd -r 8d2c9063ccc1 mail/src/main/java/javax/mail/UIDFolder.java
--- a/mail/src/main/java/javax/mail/UIDFolder.java Mon Sep 12 17:10:56 2016 -0700
+++ b/mail/src/main/java/javax/mail/UIDFolder.java Thu Sep 22 17:23:47 2016 -0700
@@ -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-2016 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
@@ -191,4 +191,22 @@
      * @exception MessagingException for other failures
      */
     public long getUID(Message message) throws MessagingException;
+
+ /**
+ * Returns the predicted UID that will be assigned to the
+ * next message that is appended to this folder.
+ * Messages might be appended to the folder after this value
+ * is retrieved, causing this value to be out of date.
+ * This value might only be updated when a folder is first opened.
+ * Note that messages may have been appended to the folder
+ * while it was open and thus this value may be out of
+ * date. <p>
+ *
+ * If the value is unknown, -1 is returned. <p>
+ *
+ * @return the UIDNEXT value, or -1 if unknown
+ * @exception MessagingException for failures
+ * @since JavaMail 1.6
+ */
+ public long getUIDNext() throws MessagingException;
 }


diff -r 8d2c9063ccc1 -r adb95dda1be6 mail.sig
--- a/mail.sig Thu Sep 22 17:23:47 2016 -0700
+++ b/mail.sig Tue Sep 27 16:02:01 2016 -0700
@@ -1,9 +1,8 @@
-#Signature file v4.1
+#Signature file v4.3
 #Version
-#NoTigerFeaturesInfo
 
 CLSS public abstract javax.mail.Address
-cons public init()
+cons public <init>()
 intf java.io.Serializable
 meth public abstract boolean equals(java.lang.Object)
 meth public abstract java.lang.String getType()
@@ -12,13 +11,14 @@
 hfds serialVersionUID
 
 CLSS public javax.mail.AuthenticationFailedException
-cons public init()
-cons public init(java.lang.String)
+cons public <init>()
+cons public <init>(java.lang.String)
+cons public <init>(java.lang.String,java.lang.Exception)
 supr javax.mail.MessagingException
 hfds serialVersionUID
 
 CLSS public abstract javax.mail.Authenticator
-cons public init()
+cons public <init>()
 meth protected final int getRequestingPort()
 meth protected final java.lang.String getDefaultUserName()
 meth protected final java.lang.String getRequestingPrompt()
@@ -29,14 +29,17 @@
 hfds requestingPort,requestingPrompt,requestingProtocol,requestingSite,requestingUserName
 
 CLSS public abstract javax.mail.BodyPart
-cons public init()
+cons public <init>()
 fld protected javax.mail.Multipart parent
 intf javax.mail.Part
 meth public javax.mail.Multipart getParent()
 supr java.lang.Object
 
+CLSS public abstract interface javax.mail.EncodingAware
+meth public abstract java.lang.String getEncoding()
+
 CLSS public javax.mail.FetchProfile
-cons public init()
+cons public <init>()
 innr public static Item
 meth public boolean contains(java.lang.String)
 meth public boolean contains(javax.mail.FetchProfile$Item)
@@ -49,19 +52,20 @@
 
 CLSS public static javax.mail.FetchProfile$Item
  outer javax.mail.FetchProfile
-cons protected init(java.lang.String)
+cons protected <init>(java.lang.String)
 fld public final static javax.mail.FetchProfile$Item CONTENT_INFO
 fld public final static javax.mail.FetchProfile$Item ENVELOPE
 fld public final static javax.mail.FetchProfile$Item FLAGS
+fld public final static javax.mail.FetchProfile$Item SIZE
 meth public java.lang.String toString()
 supr java.lang.Object
 hfds name
 
 CLSS public javax.mail.Flags
-cons public init()
-cons public init(java.lang.String)
-cons public init(javax.mail.Flags$Flag)
-cons public init(javax.mail.Flags)
+cons public <init>()
+cons public <init>(java.lang.String)
+cons public <init>(javax.mail.Flags$Flag)
+cons public <init>(javax.mail.Flags)
 innr public final static Flag
 intf java.io.Serializable
 intf java.lang.Cloneable
@@ -95,13 +99,14 @@
 hfds bit
 
 CLSS public abstract javax.mail.Folder
-cons protected init(javax.mail.Store)
+cons protected <init>(javax.mail.Store)
 fld protected int mode
 fld protected javax.mail.Store store
 fld public final static int HOLDS_FOLDERS = 2
 fld public final static int HOLDS_MESSAGES = 1
 fld public final static int READ_ONLY = 1
 fld public final static int READ_WRITE = 2
+intf java.lang.AutoCloseable
 meth protected void finalize() throws java.lang.Throwable
 meth protected void notifyConnectionListeners(int)
 meth protected void notifyFolderListeners(int)
@@ -149,6 +154,7 @@
 meth public void addFolderListener(javax.mail.event.FolderListener)
 meth public void addMessageChangedListener(javax.mail.event.MessageChangedListener)
 meth public void addMessageCountListener(javax.mail.event.MessageCountListener)
+meth public void close() throws javax.mail.MessagingException
 meth public void copyMessages(javax.mail.Message[],javax.mail.Folder) throws javax.mail.MessagingException
 meth public void fetch(javax.mail.Message[],javax.mail.FetchProfile) throws javax.mail.MessagingException
 meth public void removeConnectionListener(javax.mail.event.ConnectionListener)
@@ -160,27 +166,28 @@
 meth public void setFlags(javax.mail.Message[],javax.mail.Flags,boolean) throws javax.mail.MessagingException
 meth public void setSubscribed(boolean) throws javax.mail.MessagingException
 supr java.lang.Object
-hfds connectionListeners,folderListeners,messageChangedListeners,messageCountListeners,q,qLock
-hcls TerminatorEvent
+hfds connectionListeners,folderListeners,messageChangedListeners,messageCountListeners,q
 
 CLSS public javax.mail.FolderClosedException
-cons public init(javax.mail.Folder)
-cons public init(javax.mail.Folder,java.lang.String)
+cons public <init>(javax.mail.Folder)
+cons public <init>(javax.mail.Folder,java.lang.String)
+cons public <init>(javax.mail.Folder,java.lang.String,java.lang.Exception)
 meth public javax.mail.Folder getFolder()
 supr javax.mail.MessagingException
 hfds folder,serialVersionUID
 
 CLSS public javax.mail.FolderNotFoundException
-cons public init()
-cons public init(java.lang.String,javax.mail.Folder)
-cons public init(javax.mail.Folder)
-cons public init(javax.mail.Folder,java.lang.String)
+cons public <init>()
+cons public <init>(java.lang.String,javax.mail.Folder)
+cons public <init>(javax.mail.Folder)
+cons public <init>(javax.mail.Folder,java.lang.String)
+cons public <init>(javax.mail.Folder,java.lang.String,java.lang.Exception)
 meth public javax.mail.Folder getFolder()
 supr javax.mail.MessagingException
 hfds folder,serialVersionUID
 
 CLSS public javax.mail.Header
-cons public init(java.lang.String,java.lang.String)
+cons public <init>(java.lang.String,java.lang.String)
 fld protected java.lang.String name
 fld protected java.lang.String value
 meth public java.lang.String getName()
@@ -188,15 +195,37 @@
 supr java.lang.Object
 
 CLSS public javax.mail.IllegalWriteException
-cons public init()
-cons public init(java.lang.String)
+cons public <init>()
+cons public <init>(java.lang.String)
+cons public <init>(java.lang.String,java.lang.Exception)
 supr javax.mail.MessagingException
 hfds serialVersionUID
 
+CLSS public abstract interface !annotation javax.mail.MailSessionDefinition
+ anno 0 java.lang.annotation.Repeatable(java.lang.Class<? extends java.lang.annotation.Annotation> value=class javax.mail.MailSessionDefinitions)
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault java.lang.String description() value= ""
+meth public abstract !hasdefault java.lang.String from() value= ""
+meth public abstract !hasdefault java.lang.String host() value= ""
+meth public abstract !hasdefault java.lang.String password() value= ""
+meth public abstract !hasdefault java.lang.String storeProtocol() value= ""
+meth public abstract !hasdefault java.lang.String transportProtocol() value= ""
+meth public abstract !hasdefault java.lang.String user() value= ""
+meth public abstract !hasdefault java.lang.String[] properties() value= []
+meth public abstract java.lang.String name()
+
+CLSS public abstract interface !annotation javax.mail.MailSessionDefinitions
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract javax.mail.MailSessionDefinition[] value()
+
 CLSS public abstract javax.mail.Message
-cons protected init()
-cons protected init(javax.mail.Folder,int)
-cons protected init(javax.mail.Session)
+cons protected <init>()
+cons protected <init>(javax.mail.Folder,int)
+cons protected <init>(javax.mail.Session)
 fld protected boolean expunged
 fld protected int msgnum
 fld protected javax.mail.Folder folder
@@ -228,6 +257,7 @@
 meth public javax.mail.Address[] getAllRecipients() throws javax.mail.MessagingException
 meth public javax.mail.Address[] getReplyTo() throws javax.mail.MessagingException
 meth public javax.mail.Folder getFolder()
+meth public javax.mail.Session getSession()
 meth public void addRecipient(javax.mail.Message$RecipientType,javax.mail.Address) throws javax.mail.MessagingException
 meth public void setFlag(javax.mail.Flags$Flag,boolean) throws javax.mail.MessagingException
 meth public void setRecipient(javax.mail.Message$RecipientType,javax.mail.Address) throws javax.mail.MessagingException
@@ -236,7 +266,7 @@
 
 CLSS public static javax.mail.Message$RecipientType
  outer javax.mail.Message
-cons protected init(java.lang.String)
+cons protected <init>(java.lang.String)
 fld protected java.lang.String type
 fld public final static javax.mail.Message$RecipientType BCC
 fld public final static javax.mail.Message$RecipientType CC
@@ -251,7 +281,7 @@
 meth public abstract javax.mail.MessageContext getMessageContext()
 
 CLSS public javax.mail.MessageContext
-cons public init(javax.mail.Part)
+cons public <init>(javax.mail.Part)
 meth public javax.mail.Message getMessage()
 meth public javax.mail.Part getPart()
 meth public javax.mail.Session getSession()
@@ -259,15 +289,16 @@
 hfds part
 
 CLSS public javax.mail.MessageRemovedException
-cons public init()
-cons public init(java.lang.String)
+cons public <init>()
+cons public <init>(java.lang.String)
+cons public <init>(java.lang.String,java.lang.Exception)
 supr javax.mail.MessagingException
 hfds serialVersionUID
 
 CLSS public javax.mail.MessagingException
-cons public init()
-cons public init(java.lang.String)
-cons public init(java.lang.String,java.lang.Exception)
+cons public <init>()
+cons public <init>(java.lang.String)
+cons public <init>(java.lang.String,java.lang.Exception)
 meth public boolean setNextException(java.lang.Exception)
 meth public java.lang.Exception getNextException()
 meth public java.lang.String toString()
@@ -276,15 +307,16 @@
 hfds next,serialVersionUID
 
 CLSS public javax.mail.MethodNotSupportedException
-cons public init()
-cons public init(java.lang.String)
+cons public <init>()
+cons public <init>(java.lang.String)
+cons public <init>(java.lang.String,java.lang.Exception)
 supr javax.mail.MessagingException
 hfds serialVersionUID
 
 CLSS public abstract javax.mail.Multipart
-cons protected init()
+cons protected <init>()
 fld protected java.lang.String contentType
-fld protected java.util.Vector parts
+fld protected java.util.Vector<javax.mail.BodyPart> parts
 fld protected javax.mail.Part parent
 meth protected void setMultipartDataSource(javax.mail.MultipartDataSource) throws javax.mail.MessagingException
 meth public abstract void writeTo(java.io.OutputStream) throws java.io.IOException,javax.mail.MessagingException
@@ -305,8 +337,9 @@
 meth public abstract javax.mail.BodyPart getBodyPart(int) throws javax.mail.MessagingException
 
 CLSS public javax.mail.NoSuchProviderException
-cons public init()
-cons public init(java.lang.String)
+cons public <init>()
+cons public <init>(java.lang.String)
+cons public <init>(java.lang.String,java.lang.Exception)
 supr javax.mail.MessagingException
 hfds serialVersionUID
 
@@ -323,9 +356,9 @@
 meth public abstract java.lang.String getDisposition() throws javax.mail.MessagingException
 meth public abstract java.lang.String getFileName() throws javax.mail.MessagingException
 meth public abstract java.lang.String[] getHeader(java.lang.String) throws javax.mail.MessagingException
-meth public abstract java.util.Enumeration getAllHeaders() throws javax.mail.MessagingException
-meth public abstract java.util.Enumeration getMatchingHeaders(java.lang.String[]) throws javax.mail.MessagingException
-meth public abstract java.util.Enumeration getNonMatchingHeaders(java.lang.String[]) throws javax.mail.MessagingException
+meth public abstract java.util.Enumeration<javax.mail.Header> getAllHeaders() throws javax.mail.MessagingException
+meth public abstract java.util.Enumeration<javax.mail.Header> getMatchingHeaders(java.lang.String[]) throws javax.mail.MessagingException
+meth public abstract java.util.Enumeration<javax.mail.Header> getNonMatchingHeaders(java.lang.String[]) throws javax.mail.MessagingException
 meth public abstract javax.activation.DataHandler getDataHandler() throws javax.mail.MessagingException
 meth public abstract void addHeader(java.lang.String,java.lang.String) throws javax.mail.MessagingException
 meth public abstract void removeHeader(java.lang.String) throws javax.mail.MessagingException
@@ -340,14 +373,14 @@
 meth public abstract void writeTo(java.io.OutputStream) throws java.io.IOException,javax.mail.MessagingException
 
 CLSS public final javax.mail.PasswordAuthentication
-cons public init(java.lang.String,java.lang.String)
+cons public <init>(java.lang.String,java.lang.String)
 meth public java.lang.String getPassword()
 meth public java.lang.String getUserName()
 supr java.lang.Object
 hfds password,userName
 
 CLSS public javax.mail.Provider
-cons public init(javax.mail.Provider$Type,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
+cons public <init>(javax.mail.Provider$Type,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
 innr public static Type
 meth public java.lang.String getClassName()
 meth public java.lang.String getProtocol()
@@ -367,7 +400,7 @@
 hfds type
 
 CLSS public javax.mail.Quota
-cons public init(java.lang.String)
+cons public <init>(java.lang.String)
 fld public java.lang.String quotaRoot
 fld public javax.mail.Quota$Resource[] resources
 innr public static Resource
@@ -376,7 +409,7 @@
 
 CLSS public static javax.mail.Quota$Resource
  outer javax.mail.Quota
-cons public init(java.lang.String,long,long)
+cons public <init>(java.lang.String,long,long)
 fld public java.lang.String name
 fld public long limit
 fld public long usage
@@ -387,17 +420,18 @@
 meth public abstract void setQuota(javax.mail.Quota) throws javax.mail.MessagingException
 
 CLSS public javax.mail.ReadOnlyFolderException
-cons public init(javax.mail.Folder)
-cons public init(javax.mail.Folder,java.lang.String)
+cons public <init>(javax.mail.Folder)
+cons public <init>(javax.mail.Folder,java.lang.String)
+cons public <init>(javax.mail.Folder,java.lang.String,java.lang.Exception)
 meth public javax.mail.Folder getFolder()
 supr javax.mail.MessagingException
 hfds folder,serialVersionUID
 
 CLSS public javax.mail.SendFailedException
-cons public init()
-cons public init(java.lang.String)
-cons public init(java.lang.String,java.lang.Exception)
-cons public init(java.lang.String,java.lang.Exception,javax.mail.Address[],javax.mail.Address[],javax.mail.Address[])
+cons public <init>()
+cons public <init>(java.lang.String)
+cons public <init>(java.lang.String,java.lang.Exception)
+cons public <init>(java.lang.String,java.lang.Exception,javax.mail.Address[],javax.mail.Address[],javax.mail.Address[])
 fld protected javax.mail.Address[] invalid
 fld protected javax.mail.Address[] validSent
 fld protected javax.mail.Address[] validUnsent
@@ -408,14 +442,15 @@
 hfds serialVersionUID
 
 CLSS public abstract javax.mail.Service
-cons protected init(javax.mail.Session,javax.mail.URLName)
+cons protected <init>(javax.mail.Session,javax.mail.URLName)
 fld protected boolean debug
 fld protected javax.mail.Session session
-fld protected javax.mail.URLName url
+fld protected volatile javax.mail.URLName url
+intf java.lang.AutoCloseable
 meth protected boolean protocolConnect(java.lang.String,int,java.lang.String,java.lang.String) throws javax.mail.MessagingException
 meth protected void finalize() throws java.lang.Throwable
 meth protected void notifyConnectionListeners(int)
-meth protected void queueEvent(javax.mail.event.MailEvent,java.util.Vector)
+meth protected void queueEvent(javax.mail.event.MailEvent,java.util.Vector<? extends java.util.EventListener>)
 meth protected void setConnected(boolean)
 meth protected void setURLName(javax.mail.URLName)
 meth public b
[truncated due to length]