commits@javamail.java.net

[javamail~mercurial:664] Only need UIDPLUS if we need a UID result.

From: <shannon_at_java.net>
Date: Mon, 15 Sep 2014 22:14:53 +0000

Project: javamail
Repository: mercurial
Revision: 664
Author: shannon
Date: 2014-09-13 02:43:25 UTC
Link:

Log Message:
------------
Update version to 1.5.3-SNAPSHOT.
Add new logging APIs to javadocs.
fix threading issues in IdleManager - bug 6407
Add a log message when the message is successfully delivered to the mail server.
add more debugging output for ENVELOPE parsing
Fix deadlocks in IdleManager.
Add mail.imap.closefoldersonstorefailure property.
Preserve interrupt flag when idle is interrupted - bug 6498.
Don't include user name in Message-ID - bug 6496.
Use AtomicInteger to avoid need for synchronization.
Date search terms result in wrong greater-than IMAP SEARCH commands - bug 6526
fix StringIndexOutOfBoundsException when parsing "(x)<y_at_a>(z)" - bug 6535
check for UIDPLUS capability in copyuid method - bug 6430
merge accidentally created branch
Only need UIDPLUS if we need a UID result.


Revisions:
----------
653
654
655
656
657
658
659
660
661
662
663
664


Modified Paths:
---------------
client/pom.xml
demo/pom.xml
dsn/pom.xml
gimap/pom.xml
imap/pom.xml
javadoc/pom.xml
logging/pom.xml
mail/pom.xml
mailapi/pom.xml
mailapijar/pom.xml
mbox/native/pom.xml
mbox/pom.xml
oldmail/pom.xml
outlook/pom.xml
parent-distrib/pom.xml
pom.xml
pop3/pom.xml
publish/pom.xml
servlet/pom.xml
smtp/pom.xml
taglib/pom.xml
webapp/pom.xml
doc/release/CHANGES.txt
mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
mail/src/main/java/com/sun/mail/imap/IdleManager.java
mail/src/main/java/com/sun/mail/smtp/SMTPTransport.java
mail/src/main/java/com/sun/mail/imap/protocol/BODYSTRUCTURE.java
mail/src/main/java/com/sun/mail/imap/protocol/ENVELOPE.java
mail/src/main/java/com/sun/mail/imap/IMAPStore.java
mail/src/main/java/com/sun/mail/imap/package.html
mail/src/main/java/javax/mail/internet/UniqueValue.java
doc/release/COMPAT.txt
mail/src/main/java/com/sun/mail/imap/protocol/SearchSequence.java
mail/src/main/java/javax/mail/internet/InternetAddress.java
mail/src/test/resources/javax/mail/internet/addrlist
mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java
.hgtags


Diffs:
------
diff -r 3a10dc4569e2 -r 5f0a174007c8 client/pom.xml
--- a/client/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/client/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 demo/pom.xml
--- a/demo/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/demo/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 dsn/pom.xml
--- a/dsn/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/dsn/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 gimap/pom.xml
--- a/gimap/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/gimap/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 imap/pom.xml
--- a/imap/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/imap/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>parent-distrib</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         <relativePath>../parent-distrib/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

diff -r 3a10dc4569e2 -r 5f0a174007c8 javadoc/pom.xml
--- a/javadoc/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/javadoc/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,13 +48,13 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>
     <artifactId>javadoc</artifactId>
     <packaging>pom</packaging>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     <name>JavaMail API javadocs</name>
     <description>${project.name}</description>
 

diff -r 3a10dc4569e2 -r 5f0a174007c8 logging/pom.xml
--- a/logging/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/logging/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 mail/pom.xml
--- a/mail/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/mail/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 mailapi/pom.xml
--- a/mailapi/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/mailapi/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -56,7 +56,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 mailapijar/pom.xml
--- a/mailapijar/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/mailapijar/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -55,7 +55,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>javax.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 mbox/native/pom.xml
--- a/mbox/native/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/mbox/native/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

diff -r 3a10dc4569e2 -r 5f0a174007c8 mbox/pom.xml
--- a/mbox/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/mbox/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 oldmail/pom.xml
--- a/oldmail/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/oldmail/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -53,7 +53,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>javax.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 outlook/pom.xml
--- a/outlook/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/outlook/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 parent-distrib/pom.xml
--- a/parent-distrib/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/parent-distrib/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 pom.xml
--- a/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -54,7 +54,7 @@
     <groupId>com.sun.mail</groupId>
     <artifactId>all</artifactId>
     <packaging>pom</packaging>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     <name>JavaMail API distribution</name>
     <description>${project.name}</description>
     <url>http://javamail.java.net</url>
@@ -85,9 +85,9 @@
     </organization>
 
     <properties>
- <mail.version>1.5.2-SNAPSHOT</mail.version>
+ <mail.version>1.5.3-SNAPSHOT</mail.version>
         <!-- like mail.version, but with underscores instead of dots -->
- <mail.zipversion>1_5_2-SNAPSHOT</mail.zipversion>
+ <mail.zipversion>1_5_3-SNAPSHOT</mail.zipversion>
         <mail.spec.version>1.5</mail.spec.version>
         <activation-api.version>1.1</activation-api.version>
         <!-- defaults that are overridden in mail module -->

diff -r 3a10dc4569e2 -r 5f0a174007c8 pop3/pom.xml
--- a/pop3/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/pop3/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>parent-distrib</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         <relativePath>../parent-distrib/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

diff -r 3a10dc4569e2 -r 5f0a174007c8 publish/pom.xml
--- a/publish/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/publish/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,13 +48,13 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>
     <artifactId>publish</artifactId>
     <packaging>pom</packaging>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     <name>JavaMail API publish project</name>
 
     <build>
@@ -89,44 +89,44 @@
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         </dependency>
     <!--
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>demo</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>client</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>servlet</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>webapp</artifactId>
             <type>war</type>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>taglib</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>logging</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>outlook</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         </dependency>
     -->
     </dependencies>

diff -r 3a10dc4569e2 -r 5f0a174007c8 servlet/pom.xml
--- a/servlet/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/servlet/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 smtp/pom.xml
--- a/smtp/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/smtp/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>parent-distrib</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
         <relativePath>../parent-distrib/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

diff -r 3a10dc4569e2 -r 5f0a174007c8 taglib/pom.xml
--- a/taglib/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/taglib/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 3a10dc4569e2 -r 5f0a174007c8 webapp/pom.xml
--- a/webapp/pom.xml Wed Apr 30 14:47:45 2014 -0700
+++ b/webapp/pom.xml Mon May 12 13:50:39 2014 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.2-SNAPSHOT</version>
+ <version>1.5.3-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>


diff -r 5f0a174007c8 -r 83bf876c32a8 javadoc/pom.xml
--- a/javadoc/pom.xml Mon May 12 13:50:39 2014 -0700
+++ b/javadoc/pom.xml Wed May 14 11:44:11 2014 -0700
@@ -110,7 +110,10 @@
                         com/sun/mail/util/MailConnectException.java,
                         com/sun/mail/util/MailSSLSocketFactory.java,
                         com/sun/mail/util/ReadableMime.java,
- com/sun/mail/util/logging/MailHandler.java
+ com/sun/mail/util/logging/MailHandler.java,
+ com/sun/mail/util/logging/CollectorFormatter.java,
+ com/sun/mail/util/logging/CompactFormatter.java,
+ com/sun/mail/util/logging/SeverityComparator.java
                                         "/>
                                     <fileset dir="../dsn/src/main/java"
                                         includes="


diff -r 83bf876c32a8 -r 400f971438fe doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Wed May 14 11:44:11 2014 -0700
+++ b/doc/release/CHANGES.txt Tue May 20 14:23:15 2014 -0700
@@ -14,6 +14,13 @@
         https://kenai.com/bugzilla/
 
 
+ CHANGES IN THE 1.5.3 RELEASE
+ ----------------------------
+The following bugs have been fixed in the 1.5.3 release.
+
+K 6407 calling IdleManager.watch twice on same folder fails
+
+
                   CHANGES IN THE 1.5.2 RELEASE
                   ----------------------------
 The following bugs have been fixed in the 1.5.2 release.

diff -r 83bf876c32a8 -r 400f971438fe mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Wed May 14 11:44:11 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Tue May 20 14:23:15 2014 -0700
@@ -266,7 +266,7 @@
     private static final int IDLE = 1; // IDLE command in effect
     private static final int ABORTING = 2; // IDLE command aborting
     private int idleState = RUNNING;
- private volatile IdleManager idleManager;
+ private IdleManager idleManager;
 
     private volatile int total = -1; // total number of messages in the
                                         // message cache
@@ -2903,7 +2903,8 @@
                 throw new MessagingException(
                             "idle method not supported with SocketChannels");
         }
- startIdle(null);
+ if (!startIdle(null))
+ return;
 
         /*
          * We gave up the folder lock so that other threads
@@ -2948,20 +2949,28 @@
      * @exception IllegalStateException if the folder isn't open
      * @since JavaMail 1.5.2
      */
- void startIdle(IdleManager im) throws MessagingException {
+ boolean startIdle(final IdleManager im) throws MessagingException {
         // ASSERT: Must NOT be called with this folder's
         // synchronization lock held.
         assert !Thread.holdsLock(this);
- idleManager = im;
         synchronized(this) {
             checkOpened();
+ if (im != null && idleManager != null && im != idleManager)
+ throw new MessagingException(
+ "Folder already being watched by another IdleManager");
             Boolean started = (Boolean)doOptionalCommand("IDLE not supported",
                 new ProtocolCommand() {
                     public Object doCommand(IMAPProtocol p)
                             throws ProtocolException {
+ // if the IdleManager is already watching this folder,
+ // there's nothing to do here
+ if (idleState == IDLE &&
+ im != null && im == idleManager)
+ return Boolean.TRUE; // already watching it
                         if (idleState == RUNNING) {
                             p.idleStart();
                             idleState = IDLE;
+ idleManager = im;
                             return Boolean.TRUE;
                         } else {
                             // some other thread must be running the IDLE
@@ -2975,8 +2984,7 @@
                         }
                     }
                 });
- if (!started.booleanValue())
- return;
+ return started.booleanValue();
         }
     }
 
@@ -3000,11 +3008,13 @@
                     if (r == null || protocol == null ||
                             !protocol.processIdleResponse(r)) {
                         idleState = RUNNING;
+ idleManager = null;
                         messageCacheLock.notifyAll();
                         return false; // done
                     }
                 } catch (ProtocolException pex) {
                     idleState = RUNNING;
+ idleManager = null;
                     messageCacheLock.notifyAll();
                     throw pex; // also done
                 }
@@ -3051,7 +3061,6 @@
      * Send the DONE command that aborts the IDLE; used by IdleManager.
      */
     void idleAbort() {
- idleManager = null; // don't need it anymore
         if (protocol != null) // should always be true
             protocol.idleAbort();
     }

diff -r 83bf876c32a8 -r 400f971438fe mail/src/main/java/com/sun/mail/imap/IdleManager.java
--- a/mail/src/main/java/com/sun/mail/imap/IdleManager.java Wed May 14 11:44:11 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IdleManager.java Tue May 20 14:23:15 2014 -0700
@@ -173,7 +173,10 @@
         if (sc == null)
             throw new MessagingException("Folder is not using SocketChannels");
         logger.log(Level.FINEST, "IdleManager watching {0}", ifolder);
- ifolder.startIdle(this);
+ // keep trying to start the IDLE command until we're successful.
+ // may block if we're in the middle of aborting an IDLE command.
+ while (!ifolder.startIdle(this))
+ ;
         toWatch.add(ifolder);
         selector.wakeup();
     }


diff -r 400f971438fe -r dbb33f513aa4 mail/src/main/java/com/sun/mail/smtp/SMTPTransport.java
--- a/mail/src/main/java/com/sun/mail/smtp/SMTPTransport.java Tue May 20 14:23:15 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/smtp/SMTPTransport.java Tue Sep 02 13:41:27 2014 -0700
@@ -1209,6 +1209,7 @@
                                 lastServerResponse, exception,
                                 validSentAddr, validUnsentAddr, invalidAddr);
             }
+ logger.fine("message successfully delivered to mail server");
             notifyTransportListeners(TransportEvent.MESSAGE_DELIVERED,
                                      validSentAddr, validUnsentAddr,
                                      invalidAddr, this.message);


diff -r dbb33f513aa4 -r 912d20ca4e18 mail/src/main/java/com/sun/mail/imap/protocol/BODYSTRUCTURE.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/BODYSTRUCTURE.java Tue Sep 02 13:41:27 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/BODYSTRUCTURE.java Fri Sep 05 16:02:04 2014 -0700
@@ -82,7 +82,7 @@
     private int processedType; // MULTI | SINGLE | NESTED
 
     // special debugging output to debug parsing errors
- private static boolean parseDebug =
+ private static final boolean parseDebug =
         PropUtil.getBooleanSystemProperty("mail.imap.parse.debug", false);
 
 

diff -r dbb33f513aa4 -r 912d20ca4e18 mail/src/main/java/com/sun/mail/imap/protocol/ENVELOPE.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/ENVELOPE.java Tue Sep 02 13:41:27 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/ENVELOPE.java Fri Sep 05 16:02:04 2014 -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-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
@@ -50,6 +50,7 @@
 import javax.mail.internet.MailDateFormat;
 import javax.mail.internet.MimeUtility;
 import com.sun.mail.iap.*;
+import com.sun.mail.util.PropUtil;
 
 /**
  * The ENEVELOPE item of an IMAP FETCH response.
@@ -77,8 +78,14 @@
 
     // Used to parse dates
     private static MailDateFormat mailDateFormat = new MailDateFormat();
+
+ // special debugging output to debug parsing errors
+ private static final boolean parseDebug =
+ PropUtil.getBooleanSystemProperty("mail.imap.parse.debug", false);
     
     public ENVELOPE(FetchResponse r) throws ParsingException {
+ if (parseDebug)
+ System.out.println("parse ENVELOPE");
         msgno = r.getNumber();
 
         r.skipSpaces();
@@ -98,16 +105,36 @@
                 // date be null.
             }
         }
+ if (parseDebug)
+ System.out.println(" Date: " + date);
 
         subject = r.readString();
+ if (parseDebug)
+ System.out.println(" Subject: " + subject);
+ if (parseDebug)
+ System.out.println(" From addresses:");
         from = parseAddressList(r);
+ if (parseDebug)
+ System.out.println(" Sender addresses:");
         sender = parseAddressList(r);
+ if (parseDebug)
+ System.out.println(" Reply-To addresses:");
         replyTo = parseAddressList(r);
+ if (parseDebug)
+ System.out.println(" To addresses:");
         to = parseAddressList(r);
+ if (parseDebug)
+ System.out.println(" Cc addresses:");
         cc = parseAddressList(r);
+ if (parseDebug)
+ System.out.println(" Bcc addresses:");
         bcc = parseAddressList(r);
         inReplyTo = r.readString();
+ if (parseDebug)
+ System.out.println(" In-Reply-To: " + inReplyTo);
         messageId = r.readString();
+ if (parseDebug)
+ System.out.println(" Message-ID: " + messageId);
 
         if (r.readByte() != ')')
             throw new ParsingException("ENVELOPE parse error");
@@ -133,6 +160,8 @@
 
             do {
                 IMAPAddress a = new IMAPAddress(r);
+ if (parseDebug)
+ System.out.println(" Address: " + a);
                 // if we see an end-of-group address at the top, ignore it
                 if (!a.isEndOfGroup())
                     v.add(a);


diff -r 912d20ca4e18 -r 390e10530356 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Fri Sep 05 16:02:04 2014 -0700
+++ b/doc/release/CHANGES.txt Fri Sep 12 15:05:42 2014 -0700
@@ -19,6 +19,7 @@
 The following bugs have been fixed in the 1.5.3 release.
 
 K 6407 calling IdleManager.watch twice on same folder fails
+K 6498 IMAP idle breaks interrupt flag
 
 
                   CHANGES IN THE 1.5.2 RELEASE

diff -r 912d20ca4e18 -r 390e10530356 mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Fri Sep 05 16:02:04 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Fri Sep 12 15:05:42 2014 -0700
@@ -176,7 +176,7 @@
 
 public class IMAPFolder extends Folder implements UIDFolder, ResponseHandler {
     
- protected String fullName; // full name
+ protected volatile String fullName; // full name
     protected String name; // name
     protected int type; // folder type.
     protected char separator; // separator
@@ -528,7 +528,7 @@
     /**
      * Get the fullname of this folder.
      */
- public synchronized String getFullName() {
+ public String getFullName() {
         return fullName;
     }
 
@@ -1502,6 +1502,7 @@
         attributes = null;
         opened = false;
         idleState = RUNNING; // just in case
+ messageCacheLock.notifyAll(); // wake up anyone waiting
         notifyConnectionListeners(ConnectionEvent.CLOSED);
     }
 
@@ -2935,7 +2936,10 @@
         if (minidle > 0) {
             try {
                 Thread.sleep(minidle);
- } catch (InterruptedException ex) { }
+ } catch (InterruptedException ex) {
+ // restore the interrupted state, which callers might depend on
+ Thread.currentThread().interrupt();
+ }
         }
     }
 
@@ -2944,6 +2948,7 @@
      * IDLE processing is done later in handleIdle(), e.g., called from
      * the IdleManager.
      *
+ * @return true if IDLE started, false otherwise
      * @exception MessagingException if the server doesn't support the
      * IDLE extension
      * @exception IllegalStateException if the folder isn't open
@@ -2969,6 +2974,7 @@
                             return Boolean.TRUE; // already watching it
                         if (idleState == RUNNING) {
                             p.idleStart();
+ logger.finest("startIdle: set to IDLE");
                             idleState = IDLE;
                             idleManager = im;
                             return Boolean.TRUE;
@@ -2979,11 +2985,16 @@
                             try {
                                 // give up lock and wait to be not idle
                                 messageCacheLock.wait();
- } catch (InterruptedException ex) { }
+ } catch (InterruptedException ex) {
+ // restore the interrupted state, which callers
+ // might depend on
+ Thread.currentThread().interrupt();
+ }
                             return Boolean.FALSE;
                         }
                     }
                 });
+ logger.log(Level.FINEST, "startIdle: return {0}", started);
             return started.booleanValue();
         }
     }
@@ -3004,23 +3015,29 @@
         Response r = protocol.readIdleResponse();
         try {
             synchronized (messageCacheLock) {
+ boolean done = true;
                 try {
                     if (r == null || protocol == null ||
- !protocol.processIdleResponse(r)) {
+ !protocol.processIdleResponse(r))
+ return false; // done
+ done = false;
+ } finally {
+ if (done) {
+ logger.finest("handleIdle: set to RUNNING");
                         idleState = RUNNING;
                         idleManager = null;
                         messageCacheLock.notifyAll();
- return false; // done
                     }
- } catch (ProtocolException pex) {
- idleState = RUNNING;
- idleManager = null;
- messageCacheLock.notifyAll();
- throw pex; // also done
                 }
                 if (once) {
                     if (idleState == IDLE) {
- protocol.idleAbort();
+ try {
+ protocol.idleAbort();
+ } catch (Exception ex) {
+ // ignore any failures, still have to abort.
+ // connection failures will be detected above
+ // in the call to readIdleResponse.
+ }
                         idleState = ABORTING;
                     }
                 }
@@ -3044,16 +3061,35 @@
         while (idleState != RUNNING) {
             if (idleState == IDLE) {
                 IdleManager im = idleManager;
- if (im != null)
+ if (im != null) {
+ logger.finest("waitIfIdle: request IdleManager to abort");
                     im.requestAbort(this);
- else
+ } else {
+ logger.finest("waitIfIdle: abort IDLE");
                     protocol.idleAbort();
- idleState = ABORTING;
- }
+ idleState = ABORTING;
+ }
+ } else
+ logger.log(Level.FINEST, "waitIfIdle: idleState {0}", idleState);
             try {
                 // give up lock and wait to be not idle
+ if (logger.isLoggable(Level.FINEST))
+ logger.finest("waitIfIdle: wait to be not idle: " +
+ Thread.currentThread());
                 messageCacheLock.wait();
- } catch (InterruptedException ex) { }
+ if (logger.isLoggable(Level.FINEST))
+ logger.finest("waitIfIdle: wait done, idleState " +
+ idleState + ": " + Thread.currentThread());
+ } catch (InterruptedException ex) {
+ // restore the interrupted state, which callers might depend on
+ Thread.currentThread().interrupt();
+ // If someone is trying to interrupt us we can't keep going
+ // around the loop waiting for IDLE to complete, but we can't
+ // just return because callers expect the idleState to be
+ // RUNNING when we return. Throwing this exception seems
+ // like the best choice.
+ throw new ProtocolException("Interrupted waitIfIdle", ex);
+ }
         }
     }
 
@@ -3061,8 +3097,35 @@
      * Send the DONE command that aborts the IDLE; used by IdleManager.
      */
     void idleAbort() {
- if (protocol != null) // should always be true
- protocol.idleAbort();
+ synchronized (messageCacheLock) {
+ if (idleState == IDLE && protocol != null) {
+ protocol.idleAbort();
+ idleState = ABORTING;
+ }
+ }
+ }
+
+ /*
+ * Send the DONE command that aborts the IDLE and wait for the response;
+ * used by IdleManager.
+ */
+ void idleAbortWait() {
+ synchronized (messageCacheLock) {
+ if (idleState == IDLE && protocol != null) {
+ protocol.idleAbort();
+ idleState = ABORTING;
+
+ // read responses until OK or connection failure
+ try {
+ for (;;) {
+ if (!handleIdle(false))
+ break;
+ }
+ } catch (Exception ex) {
+ // assume it's a connection failure; nothing more to do
+ }
+ }
+ }
     }
 
     /**

diff -r 912d20ca4e18 -r 390e10530356 mail/src/main/java/com/sun/mail/imap/IMAPStore.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPStore.java Fri Sep 05 16:02:04 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPStore.java Fri Sep 12 15:05:42 2014 -0700
@@ -225,6 +225,7 @@
     private String guid; // for Yahoo! Mail IMAP
     private boolean throwSearchException = false;
     private boolean peek = false;
+ private boolean closeFoldersOnStoreFailure = true;
 
     /*
      * This field is set in the Store's response handler if we see
@@ -603,6 +604,12 @@
         if (peek)
             logger.config("peek");
 
+ // check if closeFoldersOnStoreFailure is set
+ closeFoldersOnStoreFailure = PropUtil.getBooleanSessionProperty(session,
+ "mail." + name + ".closefoldersonstorefailure", true);
+ if (closeFoldersOnStoreFailure)
+ logger.config("closeFoldersOnStoreFailure");
+
         s = session.getProperty("mail." + name + ".folder.class");
         if (s != null) {
             logger.log(Level.CONFIG, "IMAP: folder class: {0}", s);
@@ -1103,7 +1110,15 @@
                     // and wait until they're done
                     p = null;
                     pool.wait();
- } catch (InterruptedException ex) { }
+ } catch (InterruptedException ex) {
+ // restore the interrupted state, which callers might
+ // depend on
+ Thread.currentThread().interrupt();
+ // don't keep looking for a connection if we've been
+ // interrupted
+ throw new ProtocolException(
+ "Interrupted getStoreProtocol", ex);
+ }
             } else {
                 pool.storeConnectionInUse = true;
 
@@ -1607,6 +1622,7 @@
         if (logger.isLoggable(Level.FINE))
             logger.fine("IMAPStore cleanup, force " + force);
 
+ if (!force || closeFoldersOnStoreFailure) {
         Vector foldersCopy = null;
         boolean done = true;
 
@@ -1655,6 +1671,7 @@
             }
 
         }
+ }
 
         synchronized (pool) {
             emptyConnectionPool(force);
@@ -1978,7 +1995,13 @@
                     try {
                         // give up lock and wait to be not idle
                         pool.wait();
- } catch (InterruptedException ex) { }
+ } catch (InterruptedException ex) {
+ // restore the interrupted state, which callers might
+ // depend on
+ Thread.currentThread().interrupt();
+ // stop waiting and return to caller
+ throw new MessagingException("idle interrupted", ex);
+ }
                     return;
                 }
                 p.idleStart();
@@ -2025,7 +2048,11 @@
             if (minidle > 0) {
                 try {
                     Thread.sleep(minidle);
- } catch (InterruptedException ex) { }
+ } catch (InterruptedException ex) {
+ // restore the interrupted state, which callers might
+ // depend on
+ Thread.currentThread().interrupt();
+ }
             }
 
         } catch (BadCommandException bex) {
@@ -2061,7 +2088,14 @@
             try {
                 // give up lock and wait to be not idle
                 pool.wait();
- } catch (InterruptedException ex) { }
+ } catch (InterruptedException ex) {
+ // If someone is trying to interrupt us we can't keep going
+ // around the loop waiting for IDLE to complete, but we can't
+ // just return because callers expect the idleState to be
+ // RUNNING when we return. Throwing this exception seems
+ // like the best choice.
+ throw new ProtocolException("Interrupted waitIfIdle", ex);
+ }
         }
     }
 

diff -r 912d20ca4e18 -r 390e10530356 mail/src/main/java/com/sun/mail/imap/IdleManager.java
--- a/mail/src/main/java/com/sun/mail/imap/IdleManager.java Fri Sep 05 16:02:04 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IdleManager.java Fri Sep 12 15:05:42 2014 -0700
@@ -151,7 +151,12 @@
         selector = Selector.open();
         es.execute(new Runnable() {
             public void run() {
- select();
+ logger.fine("IdleManager select starting");
+ try {
+ select();
+ } finally {
+ logger.fine("IdleManager select terminating");
+ }
             }
         });
     }
@@ -233,11 +238,13 @@
         } catch (IOException ex) {
             logger.log(Level.FINE, "IdleManager got exception", ex);
         } finally {
+ logger.fine("IdleManager unwatchAll");
             try {
                 unwatchAll();
                 selector.close();
             } catch (IOException ex2) {
                 // nothing to do...
+ logger.log(Level.FINE, "IdleManager unwatch exception", ex2);
             }
             logger.fine("IdleManager exiting");
         }
@@ -256,10 +263,10 @@
         while ((folder = toWatch.poll()) != null) {
             logger.log(Level.FINEST,
                     "IdleManager adding {0} to selector", folder);
- SocketChannel sc = folder.getChannel();
- if (sc == null)
- continue;
             try {
+ SocketChannel sc = folder.getChannel();
+ if (sc == null)
+ continue;
                 // has to be non-blocking to select
                 sc.configureBlocking(false);
                 sc.register(selector, SelectionKey.OP_READ, folder);
@@ -315,6 +322,8 @@
             sc.configureBlocking(true);
             try {
                 if (folder.handleIdle(false)) {
+ logger.log(Level.FINE,
+ "IdleManager continue watching folder {0}", folder);
                     // more to do with this folder, select on it again
                     // XXX - what if we also added it above?
                     toWatch.add(folder);
@@ -337,21 +346,49 @@
     /**
      * Stop watching all folders. Cancel any selection keys and,
      * most importantly, switch the channel back to blocking mode.
+ * If there's any folders waiting to be watched, need to abort
+ * them too.
      */
     private void unwatchAll() {
+ IMAPFolder folder;
         Set<SelectionKey> keys = selector.keys();
         for (SelectionKey sk : keys) {
             // have to cancel so we can switch back to blocking I/O mode
             sk.cancel();
- IMAPFolder folder = (IMAPFolder)sk.attachment();
+ folder = (IMAPFolder)sk.attachment();
             logger.log(Level.FINE,
                 "IdleManager no longer watching folder: {0}", folder);
             SelectableChannel sc = sk.channel();
             // switch back to blocking to allow normal I/O
             try {
                 sc.configureBlocking(true);
+ folder.idleAbortWait(); // send the DONE message and wait
             } catch (IOException ex) {
                 // ignore it, channel might be closed
+ logger.log(Level.FINE,
+ "IdleManager exception while aborting idle for folder: " +
+ folder, ex);
+ }
+ }
+
+ /*
+ * Finally, process any folders waiting to be watched.
+ */
+ while ((folder = toWatch.poll()) != null) {
+ logger.log(Level.FINE,
+ "IdleManager aborting IDLE for unwatched folder: {0}", folder);
+ SocketChannel sc = folder.getChannel();
+ if (sc == null)
+ continue;
+ try {
+ // channel should still be in blocking mode, but make sure
+ sc.configureBlocking(true);
+ folder.idleAbortWait(); // send the DONE message and wait
+ } catch (IOException ex) {
+ // ignore it, channel might be closed
+ logger.log(Level.FINE,
+ "IdleManager exception while aborting idle for folder: " +
+ folder, ex);
             }
         }
     }

diff -r 912d20ca4e18 -r 390e10530356 mail/src/main/java/com/sun/mail/imap/package.html
--- a/mail/src/main/java/com/sun/mail/imap/package.html Fri Sep 05 16:02:04 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/package.html Fri Sep 12 15:05:42 2014 -0700
@@ -737,6 +737,21 @@
 </TD>
 </TR>
 
+<TR>
+<TD>mail.imap.closefoldersonstorefailure</TD>
+<TD>boolean</TD>
+<TD>
+In some cases, a failure of the Store connection indicates a failure of the
+server, and all Folders associated with that Store should also be closed.
+In other cases, a Store connection failure may be a transient failure, and
+Folders may continue to operate normally.
+If this property is true (the default), failures in the Store connection cause
+all associated Folders to be closed.
+Set this property to false to better handle transient failures in the Store
+connection.
+</TD>
+</TR>
+
 </TABLE>
 <P>
 In general, applications should not need to use the classes in this


diff -r 390e10530356 -r e7fa3bdfc8c5 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Fri Sep 12 15:05:42 2014 -0700
+++ b/doc/release/CHANGES.txt Fri Sep 12 15:10:53 2014 -0700
@@ -19,6 +19,7 @@
 The following bugs have been fixed in the 1.5.3 release.
 
 K 6407 calling IdleManager.watch twice on same folder fails
+K 6496 Message-Id leaks current user/hostname of the Java process (security)
 K 6498 IMAP idle breaks interrupt flag
 
 

diff -r 390e10530356 -r e7fa3bdfc8c5 mail/src/main/java/javax/mail/internet/UniqueValue.java
--- a/mail/src/main/java/javax/mail/internet/UniqueValue.java Fri Sep 12 15:05:42 2014 -0700
+++ b/mail/src/main/java/javax/mail/internet/UniqueValue.java Fri Sep 12 15:10:53 2014 -0700
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 1997-2010 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
@@ -41,6 +41,7 @@
 package javax.mail.internet;
 
 import java.net.*;
+import java.util.concurrent.atomic.AtomicInteger;
 import javax.mail.Session;
 
 /**
@@ -59,7 +60,7 @@
     /**
      * A global unique number, to ensure uniqueness of generated strings.
      */
- private static int id = 0;
+ private static AtomicInteger id = new AtomicInteger();
 
     /**
      * Get a unique value for use in a multipart boundary string.
@@ -70,10 +71,11 @@
      */
     public static String getUniqueBoundaryValue() {
         StringBuffer s = new StringBuffer();
+ long hash = s.hashCode();
 
         // Unique string is ----=_Part_<part>_<hashcode>.<currentTime>
- s.append("----=_Part_").append(getUniqueId()).append("_").
- append(s.hashCode()).append('.').
+ s.append("----=_Part_").append(id.getAndIncrement()).append("_").
+ append(hash).append('.').
           append(System.currentTimeMillis());
         return s.toString();
     }
@@ -83,11 +85,10 @@
      *
      * This implementation generates it by concatenating a newly
      * created object's <code>hashCode()</code>, a global ID
- * (incremented on every use), the current
- * time (in milliseconds), the string "JavaMail", and
- * this user's local address generated by
+ * (incremented on every use), the current time (in milliseconds),
+ * and the host name from this user's local address generated by
      * <code>InternetAddress.getLocalAddress()</code>.
- * (The address defaults to "javamailuser_at_localhost" if
+ * (The host name defaults to "localhost" if
      * <code>getLocalAddress()</code> returns null.)
      *
      * @param ssn Session object used to get the local address
@@ -102,22 +103,17 @@
         else {
             suffix = "javamailuser_at_localhost"; // worst-case default
         }
+ int at = suffix.lastIndexOf('@');
+ if (at >= 0)
+ suffix = suffix.substring(at);
 
         StringBuffer s = new StringBuffer();
 
- // Unique string is <hashcode>.<id>.<currentTime>.JavaMail.<suffix>
- s.append(s.hashCode()).append('.').append(getUniqueId()).append('.').
- append(System.currentTimeMillis()).append('.').
- append("JavaMail.").
+ // Unique string is <hashcode>.<id>.<currentTime><suffix>
+ s.append(s.hashCode()).append('.').
+ append(id.getAndIncrement()).append('.').
+ append(System.currentTimeMillis()).
           append(suffix);
         return s.toString();
     }
-
- /**
- * Ensure ID is unique by synchronizing access.
- * XXX - Could use AtomicInteger.getAndIncrement() in J2SE 5.0.
- */
- private static synchronized int getUniqueId() {
- return id++;
- }
 }


diff -r e7fa3bdfc8c5 -r 052dca90603a doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Fri Sep 12 15:10:53 2014 -0700
+++ b/doc/release/CHANGES.txt Fri Sep 12 15:57:00 2014 -0700
@@ -21,6 +21,7 @@
 K 6407 calling IdleManager.watch twice on same folder fails
 K 6496 Message-Id leaks current user/hostname of the Java process (security)
 K 6498 IMAP idle breaks interrupt flag
+K 6526 Date search terms result in wrong greater-than SEARCH commands for IMAP
 
 
                   CHANGES IN THE 1.5.2 RELEASE

diff -r e7fa3bdfc8c5 -r 052dca90603a doc/release/COMPAT.txt
--- a/doc/release/COMPAT.txt Fri Sep 12 15:10:53 2014 -0700
+++ b/doc/release/COMPAT.txt Fri Sep 12 15:57:00 2014 -0700
@@ -14,6 +14,17 @@
 with this release of the JavaMail API.
 
 
+-- JavaMail 1.5.3 --
+
+- Date search terms result in wrong greater-than SEARCH commands for IMAP
+
+ The IMAP SentDateTerm and ReceivedDateTerm greater-than comparison
+ was actually doing a greater-than-or-equal-to comparison. This
+ has been fixed in the 1.5.3 release, but programs that accidentally
+ relied on the old behavior may get different results.
+
+
+
 -- JavaMail 1.5 --
 
 - RFC 2231 parameter encoding/decoding enabled by default

diff -r e7fa3bdfc8c5 -r 052dca90603a mail/src/main/java/com/sun/mail/imap/protocol/SearchSequence.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/SearchSequence.java Fri Sep 12 15:10:53 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/SearchSequence.java Fri Sep 12 15:57:00 2014 -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-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
@@ -367,6 +367,10 @@
 
     // Date SEARCH stuff ...
 
+ // NOTE: The built-in IMAP date comparisons are equivalent to
+ // "<" (BEFORE), "=" (ON), and ">=" (SINCE)!!!
+ // There is no built-in greater-than comparison!
+
     /**
      * Print an IMAP Date string, that is suitable for the Date
      * SEARCH commands.
@@ -403,7 +407,7 @@
 
         switch (term.getComparison()) {
             case ComparisonTerm.GT:
- result.writeAtom("SENTSINCE " + date);
+ result.writeAtom("NOT SENTON " + date + " SENTSINCE " + date);
                 break;
             case ComparisonTerm.EQ:
                 result.writeAtom("SENTON " + date);
@@ -412,7 +416,7 @@
                 result.writeAtom("SENTBEFORE " + date);
                 break;
             case ComparisonTerm.GE:
- result.writeAtom("OR SENTSINCE " + date + " SENTON " + date);
+ result.writeAtom("SENTSINCE " + date);
                 break;
             case ComparisonTerm.LE:
                 result.writeAtom("OR SENTBEFORE " + date + " SENTON " + date);
@@ -434,7 +438,7 @@
 
         switch (term.getComparison()) {
             case ComparisonTerm.GT:
- result.writeAtom("SINCE " + date);
+ result.writeAtom("NOT ON " + date + " SINCE " + date);
                 break;
             case ComparisonTerm.EQ:
                 result.writeAtom("ON " + date);
@@ -443,7 +447,7 @@
                 result.writeAtom("BEFORE " + date);
                 break;
             case ComparisonTerm.GE:
- result.writeAtom("OR SINCE " + date + " ON " + date);
+ result.writeAtom("SINCE " + date);
                 break;
             case ComparisonTerm.LE:
                 result.writeAtom("OR BEFORE " + date + " ON " + date);


diff -r 052dca90603a -r a6566d1a2064 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Fri Sep 12 15:57:00 2014 -0700
+++ b/doc/release/CHANGES.txt Fri Sep 12 17:14:14 2014 -0700
@@ -22,6 +22,7 @@
 K 6496 Message-Id leaks current user/hostname of the Java process (security)
 K 6498 IMAP idle breaks interrupt flag
 K 6526 Date search terms result in wrong greater-than SEARCH commands for IMAP
+K 6535 address similar to (x)<y>(z) will throw StringIndexOutOfBoundsException
 
 
                   CHANGES IN THE 1.5.2 RELEASE

diff -r 052dca90603a -r a6566d1a2064 mail/src/main/java/javax/mail/internet/InternetAddress.java
--- a/mail/src/main/java/javax/mail/internet/InternetAddress.java Fri Sep 12 15:57:00 2014 -0700
+++ b/mail/src/main/java/javax/mail/internet/InternetAddress.java Fri Sep 12 17:14:14 2014 -0700
@@ -823,9 +823,11 @@
                 }
 
                 if (!in_group) {
- start_personal = start;
- if (start_personal >= 0)
+ if (start >= 0) {
+ // seen some characters? use them as the personal name
+ start_personal = start;
                         end_personal = rindex;
+ }
                     start = rindex + 1;
                 }
                 route_addr = true;

diff -r 052dca90603a -r a6566d1a2064 mail/src/test/resources/javax/mail/internet/addrlist
--- a/mail/src/test/resources/javax/mail/internet/addrlist Fri Sep 12 15:57:00 2014 -0700
+++ b/mail/src/test/resources/javax/mail/internet/addrlist Fri Sep 12 17:14:14 2014 -0700
@@ -2,7 +2,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
@@ -88,6 +88,9 @@
         ~user/mailbox
         ~/mailbox
         /PN=x400.address/PRMD=ibmmail/ADMD=ibmx400/C=us/_at_mhs-mci.ebay
+To: (x)<y_at_a>(z)
+Expect: 1
+ y_at_a
 Comment: as above, but strict
 Strict: true
 To: ggere /tmp/mail.out +mailbox ~user/mailbox ~/mailbox /PN=x400.address/PRMD=ibmmail/ADMD=ibmx400/C=us/_at_mhs-mci.ebay


diff -r a6566d1a2064 -r 9ec33e2daa00 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Fri Sep 12 17:14:14 2014 -0700
+++ b/doc/release/CHANGES.txt Fri Sep 12 17:28:42 2014 -0700
@@ -19,6 +19,7 @@
 The following bugs have been fixed in the 1.5.3 release.
 
 K 6407 calling IdleManager.watch twice on same folder fails
+K 6430 NPE in IMAPFolder.copyUIDMessages when COPYUID not returned
 K 6496 Message-Id leaks current user/hostname of the Java process (security)
 K 6498 IMAP idle breaks interrupt flag
 K 6526 Date search terms result in wrong greater-than SEARCH commands for IMAP

diff -r a6566d1a2064 -r 9ec33e2daa00 mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java Fri Sep 12 17:14:14 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java Fri Sep 12 17:28:42 2014 -0700
@@ -1783,6 +1783,8 @@
 
     public CopyUID copyuid(String msgSequence, String mbox, boolean uid)
                                 throws ProtocolException {
+ if (!hasCapability("UIDPLUS"))
+ throw new BadCommandException("UIDPLUS not supported");
         // encode the mbox as per RFC2060
         mbox = BASE64MailboxEncoder.encode(mbox);
 


diff -r 9ec33e2daa00 -r 4eeb68a96552 .hgtags
--- a/.hgtags Fri Sep 12 17:28:42 2014 -0700
+++ b/.hgtags Fri Sep 12 17:39:55 2014 -0700
@@ -16,3 +16,4 @@
 ba4e734fdfa9916c0e8867b8ea8b4218e276be0e JAVAMAIL-1_4_7
 fa1edb81787d0b26828cee438a6d54df619fa6da JAVAMAIL-1_5_0
 f6c4d3181f06de080bb3b107382464fad875dfdb JAVAMAIL-1_5_1
+1cbe387fd6841ae0f1c5c6da1e7f872c49255f1d JAVAMAIL-1_5_2


diff -r 4eeb68a96552 -r e77aff7a9a37 mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java
--- a/mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java Fri Sep 12 17:39:55 2014 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java Fri Sep 12 19:43:25 2014 -0700
@@ -1783,7 +1783,7 @@
 
     public CopyUID copyuid(String msgSequence, String mbox, boolean uid)
                                 throws ProtocolException {
- if (!hasCapability("UIDPLUS"))
+ if (uid && !hasCapability("UIDPLUS"))
             throw new BadCommandException("UIDPLUS not supported");
         // encode the mbox as per RFC2060
         mbox = BASE64MailboxEncoder.encode(mbox);